|
|
@ -10,12 +10,12 @@ var NavigationMixin = { |
|
|
|
* |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_relocateUI : function() { |
|
|
|
_relocateNavigation : function() { |
|
|
|
if (this.sectors !== undefined) { |
|
|
|
var xOffset = this.UIclientWidth - this.frame.canvas.clientWidth; |
|
|
|
var yOffset = this.UIclientHeight - this.frame.canvas.clientHeight; |
|
|
|
this.UIclientWidth = this.frame.canvas.clientWidth; |
|
|
|
this.UIclientHeight = this.frame.canvas.clientHeight; |
|
|
|
var xOffset = this.navigationClientWidth - this.frame.canvas.clientWidth; |
|
|
|
var yOffset = this.navigationClientHeight - this.frame.canvas.clientHeight; |
|
|
|
this.navigationClientWidth = this.frame.canvas.clientWidth; |
|
|
|
this.navigationClientHeight = this.frame.canvas.clientHeight; |
|
|
|
var node = null; |
|
|
|
|
|
|
|
for (var nodeId in this.sectors["navigation"]["nodes"]) { |
|
|
@ -37,45 +37,45 @@ var NavigationMixin = { |
|
|
|
* Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation |
|
|
|
* they have a triggerFunction which is called on click. If the position of the navigation controls is dependent |
|
|
|
* on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. |
|
|
|
* This means that the location will be corrected by the _relocateUI function on a size change of the canvas. |
|
|
|
* This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. |
|
|
|
* |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_loadUIElements : function() { |
|
|
|
_loadNavigationElements : function() { |
|
|
|
var DIR = this.constants.navigation.iconPath; |
|
|
|
this.UIclientWidth = this.frame.canvas.clientWidth; |
|
|
|
this.UIclientHeight = this.frame.canvas.clientHeight; |
|
|
|
if (this.UIclientWidth === undefined) { |
|
|
|
this.UIclientWidth = 0; |
|
|
|
this.UIclientHeight = 0; |
|
|
|
this.navigationClientWidth = this.frame.canvas.clientWidth; |
|
|
|
this.navigationClientHeight = this.frame.canvas.clientHeight; |
|
|
|
if (this.navigationClientWidth === undefined) { |
|
|
|
this.navigationClientWidth = 0; |
|
|
|
this.navigationClientHeight = 0; |
|
|
|
} |
|
|
|
var offset = 15; |
|
|
|
var intermediateOffset = 7; |
|
|
|
var UINodes = [ |
|
|
|
{id: 'UI_up', shape: 'image', image: DIR + 'uparrow.png', triggerFunction: "_moveUp", |
|
|
|
verticalAlignTop: false, x: 45 + offset + intermediateOffset, y: this.UIclientHeight - 45 - offset - intermediateOffset}, |
|
|
|
{id: 'UI_down', shape: 'image', image: DIR + 'downarrow.png', triggerFunction: "_moveDown", |
|
|
|
verticalAlignTop: false, x: 45 + offset + intermediateOffset, y: this.UIclientHeight - 15 - offset}, |
|
|
|
{id: 'UI_left', shape: 'image', image: DIR + 'leftarrow.png', triggerFunction: "_moveLeft", |
|
|
|
verticalAlignTop: false, x: 15 + offset, y: this.UIclientHeight - 15 - offset}, |
|
|
|
{id: 'UI_right', shape: 'image', image: DIR + 'rightarrow.png',triggerFunction: "_moveRight", |
|
|
|
verticalAlignTop: false, x: 75 + offset + 2 * intermediateOffset, y: this.UIclientHeight - 15 - offset}, |
|
|
|
|
|
|
|
{id: 'UI_plus', shape: 'image', image: DIR + 'plus.png', triggerFunction: "_zoomIn", |
|
|
|
var navigationNodes = [ |
|
|
|
{id: 'navigation_up', shape: 'image', image: DIR + 'uparrow.png', triggerFunction: "_moveUp", |
|
|
|
verticalAlignTop: false, x: 45 + offset + intermediateOffset, y: this.navigationClientHeight - 45 - offset - intermediateOffset}, |
|
|
|
{id: 'navigation_down', shape: 'image', image: DIR + 'downarrow.png', triggerFunction: "_moveDown", |
|
|
|
verticalAlignTop: false, x: 45 + offset + intermediateOffset, y: this.navigationClientHeight - 15 - offset}, |
|
|
|
{id: 'navigation_left', shape: 'image', image: DIR + 'leftarrow.png', triggerFunction: "_moveLeft", |
|
|
|
verticalAlignTop: false, x: 15 + offset, y: this.navigationClientHeight - 15 - offset}, |
|
|
|
{id: 'navigation_right', shape: 'image', image: DIR + 'rightarrow.png',triggerFunction: "_moveRight", |
|
|
|
verticalAlignTop: false, x: 75 + offset + 2 * intermediateOffset, y: this.navigationClientHeight - 15 - offset}, |
|
|
|
|
|
|
|
{id: 'navigation_plus', shape: 'image', image: DIR + 'plus.png', triggerFunction: "_zoomIn", |
|
|
|
verticalAlignTop: false, horizontalAlignLeft: false, |
|
|
|
x: this.UIclientWidth - 45 - offset - intermediateOffset, y: this.UIclientHeight - 15 - offset}, |
|
|
|
{id: 'UI_min', shape: 'image', image: DIR + 'minus.png', triggerFunction: "_zoomOut", |
|
|
|
x: this.navigationClientWidth - 45 - offset - intermediateOffset, y: this.navigationClientHeight - 15 - offset}, |
|
|
|
{id: 'navigation_min', shape: 'image', image: DIR + 'minus.png', triggerFunction: "_zoomOut", |
|
|
|
verticalAlignTop: false, horizontalAlignLeft: false, |
|
|
|
x: this.UIclientWidth - 15 - offset, y: this.UIclientHeight - 15 - offset}, |
|
|
|
{id: 'UI_zoomExtends', shape: 'image', image: DIR + 'zoomExtends.png', triggerFunction: "zoomToFit", |
|
|
|
x: this.navigationClientWidth - 15 - offset, y: this.navigationClientHeight - 15 - offset}, |
|
|
|
{id: 'navigation_zoomExtends', shape: 'image', image: DIR + 'zoomExtends.png', triggerFunction: "zoomToFit", |
|
|
|
verticalAlignTop: false, horizontalAlignLeft: false, |
|
|
|
x: this.UIclientWidth - 15 - offset, y: this.UIclientHeight - 45 - offset - intermediateOffset} |
|
|
|
x: this.navigationClientWidth - 15 - offset, y: this.navigationClientHeight - 45 - offset - intermediateOffset} |
|
|
|
]; |
|
|
|
|
|
|
|
var nodeObj = null; |
|
|
|
for (var i = 0; i < UINodes.length; i++) { |
|
|
|
for (var i = 0; i < navigationNodes.length; i++) { |
|
|
|
nodeObj = this.sectors["navigation"]['nodes']; |
|
|
|
nodeObj[UINodes[i]['id']] = new Node(UINodes[i], this.images, this.groups, this.constants); |
|
|
|
nodeObj[navigationNodes[i]['id']] = new Node(navigationNodes[i], this.images, this.groups, this.constants); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -87,7 +87,7 @@ var NavigationMixin = { |
|
|
|
* @param {String} elementId |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_highlightUIElement : function(elementId) { |
|
|
|
_highlightNavigationElement : function(elementId) { |
|
|
|
if (this.sectors["navigation"]["nodes"].hasOwnProperty(elementId)) { |
|
|
|
this.sectors["navigation"]["nodes"][elementId].clusterSize = 2; |
|
|
|
} |
|
|
@ -100,7 +100,7 @@ var NavigationMixin = { |
|
|
|
* @param {String} elementId |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_unHighlightUIElement : function(elementId) { |
|
|
|
_unHighlightNavigationElement : function(elementId) { |
|
|
|
if (this.sectors["navigation"]["nodes"].hasOwnProperty(elementId)) { |
|
|
|
this.sectors["navigation"]["nodes"][elementId].clusterSize = 1; |
|
|
|
} |
|
|
@ -113,7 +113,7 @@ var NavigationMixin = { |
|
|
|
_unHighlightAll : function() { |
|
|
|
for (var nodeId in this.sectors['navigation']['nodes']) { |
|
|
|
if (this.sectors['navigation']['nodes'].hasOwnProperty(nodeId)) { |
|
|
|
this._unHighlightUIElement(nodeId); |
|
|
|
this._unHighlightNavigationElement(nodeId); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
@ -139,7 +139,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_moveUp : function(event) { |
|
|
|
this._highlightUIElement("UI_up"); |
|
|
|
this._highlightNavigationElement("navigation_up"); |
|
|
|
this.yIncrement = this.constants.keyboard.speed.y; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -151,7 +151,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_moveDown : function(event) { |
|
|
|
this._highlightUIElement("UI_down"); |
|
|
|
this._highlightNavigationElement("navigation_down"); |
|
|
|
this.yIncrement = -this.constants.keyboard.speed.y; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -163,7 +163,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_moveLeft : function(event) { |
|
|
|
this._highlightUIElement("UI_left"); |
|
|
|
this._highlightNavigationElement("navigation_left"); |
|
|
|
this.xIncrement = this.constants.keyboard.speed.x; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -175,7 +175,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_moveRight : function(event) { |
|
|
|
this._highlightUIElement("UI_right"); |
|
|
|
this._highlightNavigationElement("navigation_right"); |
|
|
|
this.xIncrement = -this.constants.keyboard.speed.y; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -187,7 +187,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_zoomIn : function(event) { |
|
|
|
this._highlightUIElement("UI_plus"); |
|
|
|
this._highlightNavigationElement("navigation_plus"); |
|
|
|
this.zoomIncrement = this.constants.keyboard.speed.zoom; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -199,7 +199,7 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_zoomOut : function() { |
|
|
|
this._highlightUIElement("UI_min"); |
|
|
|
this._highlightNavigationElement("navigation_min"); |
|
|
|
this.zoomIncrement = -this.constants.keyboard.speed.zoom; |
|
|
|
this.start(); // if there is no node movement, the calculation wont be done
|
|
|
|
this._preventDefault(event); |
|
|
@ -211,8 +211,8 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_stopZoom : function() { |
|
|
|
this._unHighlightUIElement("UI_plus"); |
|
|
|
this._unHighlightUIElement("UI_min"); |
|
|
|
this._unHighlightNavigationElement("navigation_plus"); |
|
|
|
this._unHighlightNavigationElement("navigation_min"); |
|
|
|
|
|
|
|
this.zoomIncrement = 0; |
|
|
|
}, |
|
|
@ -223,8 +223,8 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_yStopMoving : function() { |
|
|
|
this._unHighlightUIElement("UI_up"); |
|
|
|
this._unHighlightUIElement("UI_down"); |
|
|
|
this._unHighlightNavigationElement("navigation_up"); |
|
|
|
this._unHighlightNavigationElement("navigation_down"); |
|
|
|
|
|
|
|
this.yIncrement = 0; |
|
|
|
}, |
|
|
@ -235,8 +235,8 @@ var NavigationMixin = { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_xStopMoving : function() { |
|
|
|
this._unHighlightUIElement("UI_left"); |
|
|
|
this._unHighlightUIElement("UI_right"); |
|
|
|
this._unHighlightNavigationElement("navigation_left"); |
|
|
|
this._unHighlightNavigationElement("navigation_right"); |
|
|
|
|
|
|
|
this.xIncrement = 0; |
|
|
|
} |
|
|
|