|
|
@ -4,8 +4,8 @@ var Hammer = require('../../module/hammer'); |
|
|
|
exports._cleanNavigation = function() { |
|
|
|
// clean up previous navigation items
|
|
|
|
var wrapper = document.getElementById('network-navigation_wrapper'); |
|
|
|
if (wrapper != null) { |
|
|
|
this.containerElement.removeChild(wrapper); |
|
|
|
if (wrapper && wrapper.parentNode) { |
|
|
|
wrapper.parentNode.removeChild(wrapper); |
|
|
|
} |
|
|
|
document.onmouseup = null; |
|
|
|
}; |
|
|
@ -26,23 +26,20 @@ exports._loadNavigationElements = function() { |
|
|
|
var navigationDivActions = ['_moveUp','_moveDown','_moveLeft','_moveRight','_zoomIn','_zoomOut','zoomExtent']; |
|
|
|
|
|
|
|
this.navigationDivs['wrapper'] = document.createElement('div'); |
|
|
|
this.navigationDivs['wrapper'].id = "network-navigation_wrapper"; |
|
|
|
this.navigationDivs['wrapper'].style.position = "absolute"; |
|
|
|
this.navigationDivs['wrapper'].style.width = this.frame.canvas.clientWidth + "px"; |
|
|
|
this.navigationDivs['wrapper'].style.height = this.frame.canvas.clientHeight + "px"; |
|
|
|
this.containerElement.insertBefore(this.navigationDivs['wrapper'],this.frame); |
|
|
|
this.navigationDivs['wrapper'].id = 'network-navigation_wrapper'; |
|
|
|
this.frame.appendChild(this.navigationDivs['wrapper'],this.frame); |
|
|
|
|
|
|
|
var me = this; |
|
|
|
for (var i = 0; i < navigationDivs.length; i++) { |
|
|
|
this.navigationDivs[navigationDivs[i]] = document.createElement('div'); |
|
|
|
this.navigationDivs[navigationDivs[i]].id = "network-navigation_" + navigationDivs[i]; |
|
|
|
this.navigationDivs[navigationDivs[i]].className = "network-navigation " + navigationDivs[i]; |
|
|
|
this.navigationDivs[navigationDivs[i]].id = 'network-navigation_' + navigationDivs[i]; |
|
|
|
this.navigationDivs[navigationDivs[i]].className = 'network-navigation ' + navigationDivs[i]; |
|
|
|
this.navigationDivs['wrapper'].appendChild(this.navigationDivs[navigationDivs[i]]); |
|
|
|
var hammer = Hammer(this.navigationDivs[navigationDivs[i]], {prevent_default: true}); |
|
|
|
hammer.on("touch", me[navigationDivActions[i]].bind(me)); |
|
|
|
hammer.on('touch', me[navigationDivActions[i]].bind(me)); |
|
|
|
} |
|
|
|
var hammer = Hammer(document, {prevent_default: false}); |
|
|
|
hammer.on("release", me._stopMovement.bind(me)); |
|
|
|
hammer.on('release', me._stopMovement.bind(me)); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|