@ -153,7 +153,6 @@ class InteractionHandler {
this . drag . selection = [ ] ;
this . drag . translation = util . extend ( { } , this . body . view . translation ) ; // copy the object
this . drag . nodeId = null ;
this . draggingNodes = false ;
this . body . emitter . emit ( "dragStart" , { nodeIds : this . selectionHandler . getSelection ( ) . nodes } ) ;
@ -161,6 +160,7 @@ class InteractionHandler {
this . drag . nodeId = node . id ;
// select the clicked node if not yet selected
if ( node . isSelected ( ) === false ) {
this . selectionHandler . unselectAll ( ) ;
this . selectionHandler . selectObject ( node ) ;
}
@ -274,6 +274,7 @@ class InteractionHandler {
* @ private
* /
onPinch ( event ) {
console . log ( "on pinch" )
var pointer = this . getPointer ( event . center ) ;
this . drag . pinched = true ;
@ -387,76 +388,76 @@ class InteractionHandler {
* @ private
* /
onMouseMove ( event ) {
var pointer = { x : event . pageX , y : event . pageY } ;
var popupVisible = false ;
// check if the previously selected node is still selected
if ( this . popup !== undefined ) {
if ( this . popup . hidden === false ) {
this . _checkHidePopup ( pointer ) ;
}
// if the popup was not hidden above
if ( this . popup . hidden === false ) {
popupVisible = true ;
this . popup . setPosition ( pointer . x + 3 , pointer . y - 5 )
this . popup . show ( ) ;
}
}
// if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over
if ( this . options . keyboard . bindToWindow == false && this . options . keyboard . enabled === true ) {
this . canvas . frame . focus ( ) ;
}
// start a timeout that will check if the mouse is positioned above an element
if ( popupVisible === false ) {
var me = this ;
var checkShow = function ( ) {
me . _checkShowPopup ( pointer ) ;
} ;
if ( this . popupTimer ) {
clearInterval ( this . popupTimer ) ; // stop any running calculationTimer
}
if ( ! this . drag . dragging ) {
this . popupTimer = setTimeout ( checkShow , this . options . tooltip . delay ) ;
}
}
/ * *
* Adding hover highlights
* /
if ( this . options . hoverEnabled === true ) {
// removing all hover highlights
for ( var edgeId in this . hoverObj . edges ) {
if ( this . hoverObj . edges . hasOwnProperty ( edgeId ) ) {
this . hoverObj . edges [ edgeId ] . hover = false ;
delete this . hoverObj . edges [ edgeId ] ;
}
}
// adding hover highlights
var obj = this . selectionHandler . getNodeAt ( pointer ) ;
if ( obj == null ) {
obj = this . selectionHandler . getEdgeAt ( pointer ) ;
}
if ( obj != null ) {
this . _hoverObject ( obj ) ;
}
// removing all node hover highlights except for the selected one.
for ( var nodeId in this . hoverObj . nodes ) {
if ( this . hoverObj . nodes . hasOwnProperty ( nodeId ) ) {
if ( obj instanceof Node && obj . id != nodeId || obj instanceof Edge || obj == null ) {
this . _blurObject ( this . hoverObj . nodes [ nodeId ] ) ;
delete this . hoverObj . nodes [ nodeId ] ;
}
}
}
this . body . emitter . emit ( "_requestRedraw" ) ;
}
// var pointer = {x:event.pageX, y:event.pageY};
// var popupVisible = false;
//
// // check if the previously selected node is still selected
// if (this.popup !== undefined) {
// if (this.popup.hidden === false) {
// this._checkHidePopup(pointer);
// }
//
// // if the popup was not hidden above
// if (this.popup.hidden === false) {
// popupVisible = true;
// this.popup.setPosition(pointer.x + 3, pointer.y - 5)
// this.popup.show();
// }
// }
//
// // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over
// if (this.options.keyboard.bindToWindow == false && this.options.keyboard.enabled === true) {
// this.canvas.frame.focus();
// }
//
// // start a timeout that will check if the mouse is positioned above an element
// if (popupVisible === false) {
// var me = this;
// var checkShow = function() {
// me._checkShowPopup(pointer);
// };
//
// if (this.popupTimer) {
// clearInterval(this.popupTimer); // stop any running calculationTimer
// }
// if (!this.drag.dragging) {
// this.popupTimer = setTimeout(checkShow, this.options.tooltip.delay);
// }
// }
//
// /**
// * Adding hover highlights
// */
// if (this.options.hoverEnabled === true) {
// // removing all hover highlights
// for (var edgeId in this.hoverObj.edges) {
// if (this.hoverObj.edges.hasOwnProperty(edgeId)) {
// this.hoverObj.edges[edgeId].hover = false;
// delete this.hoverObj.edges[edgeId];
// }
// }
//
// // adding hover highlights
// var obj = this.selectionHandler.getNodeAt(pointer);
// if (obj == null) {
// obj = this.selectionHandler.getEdgeAt(pointer);
// }
// if (obj != null) {
// this._hoverObject(obj);
// }
//
// // removing all node hover highlights except for the selected one.
// for (var nodeId in this.hoverObj.nodes) {
// if (this.hoverObj.nodes.hasOwnProperty(nodeId)) {
// if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj == null) {
// this._blurObject(this.hoverObj.nodes[nodeId]);
// delete this.hoverObj.nodes[nodeId];
// }
// }
// }
// this.body.emitter.emit("_requestRedraw");
// }
}
}
export { TouchEvent Handler} ;
export { Interaction Handler} ;