コード例 #1
0
ファイル: TabBar.js プロジェクト: 2w2m/dojox
	var checkSpreadedChildren = function(/* String */ tabBarId, /* Number */ nbOfButtons, /* Number */ tabBarPaddingPlusBorderPlusMarginWidth){
		var tabBarPosition = geom.position(tabBarId);
		var tabBarButtonsPositions = [];
		for (var i=1; i <= nbOfButtons; i++){
			var node = dojo.byId(tabBarId + "-button" + i);
			tabBarButtonsPositions[i] = geom.position(node);
		}
		console.log(tabBarId);
		console.log(tabBarPosition);
		console.log(tabBarButtonsPositions);
		doh.assertEqual(Math.round(tabBarPosition.w - tabBarPaddingPlusBorderPlusMarginWidth), Math.round(tabBarButtonsPositions[1].w * nbOfButtons), tabBarId + " > button 1 size");
		for (var j=2; j <= nbOfButtons; j++){
			doh.assertEqual(Math.round(tabBarButtonsPositions[1].w), Math.round(tabBarButtonsPositions[j].w), tabBarId + " > button " + j + " size");
		}
	};
コード例 #2
0
	handleMouseDown: function(evt) {
		var domClass = require("dojo/dom-class");
		var domGeometry = require("dojo/dom-geometry");
		var query = require("dojo/query");
		if (this.activePanel["active"] != null && this.activePanel["selected"] != null) {
			var widgetNode = dojo.byId(this.activePanel["active"]);
			var toggleControl = dojo.byId(this.activePanel["selected"]);
			if (widgetNode) {
				var node = evt.target;
				if (node != document.documentElement) {
					var close = true;
					while (node && node != document.documentElement) {
						if (dojo.byId(node.id + "_dropdown") != null && dojo.byId(widgetNode.id + "_numEntitledContracts") != null && 
						    dojo.byId(widgetNode.id + "_numEntitledContracts").value > 0){
							var nodePosition = domGeometry.position(node);
							var windowHeight = window.innerHeight;
							if (windowHeight - nodePosition.y > nodePosition.y){
								var newHeight = windowHeight - nodePosition.y;
							}else{
								var newHeight = nodePosition.y;
							}
							var dropdownHeight = dojo.byId(node.id + "_dropdown").clientHeight;	
							if (dropdownHeight > newHeight){
								dojo.byId(node.id + "_dropdown").style.height = newHeight + "px"; 																		
							}							
						}
						if (node == widgetNode || node == toggleControl || domClass.contains(node, "dijitPopup")) {
							close = false;
							break;
						}
						node = node.parentNode;
					}
					if (node == null) {
						var children = query("div", widgetNode);
						for (var i = 0; i < children.length; i++) {
							var position = domGeometry.position(children[i]);
							if (evt.clientX >= position.x && evt.clientX < position.x + position.w &&
								evt.clientY >= position.y && evt.clientY < position.y + position.h) {								
								close = false;
								break;
							}
						}
						if (dojo.byId(widgetNode.id + "_WC_B2BMyAccountParticipantRole_select_2_dropdown") != null && 
							dojo.byId(widgetNode.id + "_WC_B2BMyAccountParticipantRole_select_2_dropdown").style.display != "none" &&
							dojo.byId(widgetNode.id + "_numEntitledContracts") != null && dojo.byId(widgetNode.id + "_numEntitledContracts").value > 0){
							var nodePosition = domGeometry.position(dojo.byId(widgetNode.id + "_WC_B2BMyAccountParticipantRole_select_2"));
							var windowHeight = window.innerHeight;
							if (windowHeight - nodePosition.y > nodePosition.y){
								var newHeight = windowHeight - nodePosition.y;
							}else{
								var newHeight = nodePosition.y;
							}
							var dropdownHeight = dojo.byId(widgetNode.id + "_WC_B2BMyAccountParticipantRole_select_2_dropdown").clientHeight;	
							if (dropdownHeight > newHeight){
								dojo.byId(widgetNode.id + "_WC_B2BMyAccountParticipantRole_select_2_dropdown").style.height = newHeight + "px"; 																		
							}							
						}
					}					
					if (close) {
						this.togglePanel(widgetNode);
					}
				}
			}
		}
	}