Basic double click handler
This commit is contained in:
parent
4c0a9e3e28
commit
3df408fcc1
|
@ -6,7 +6,10 @@
|
|||
<script>
|
||||
var graph = new Graph();
|
||||
|
||||
var dennis = graph.newNode({label: 'Dennis'});
|
||||
var dennis = graph.newNode({
|
||||
label: 'Dennis',
|
||||
ondoubleclick: function() { console.log("Hello!"); }
|
||||
});
|
||||
var michael = graph.newNode({label: 'Michael'});
|
||||
var jessica = graph.newNode({label: 'Jessica'});
|
||||
var timothy = graph.newNode({label: 'Timothy'});
|
||||
|
|
13
springyui.js
13
springyui.js
|
@ -77,8 +77,6 @@ jQuery.fn.springy = function(params) {
|
|||
var dragged = null;
|
||||
|
||||
jQuery(canvas).mousedown(function(e) {
|
||||
jQuery('.actions').hide();
|
||||
|
||||
var pos = jQuery(this).offset();
|
||||
var p = fromScreen({x: e.pageX - pos.left, y: e.pageY - pos.top});
|
||||
selected = nearest = dragged = layout.nearest(p);
|
||||
|
@ -94,6 +92,17 @@ jQuery.fn.springy = function(params) {
|
|||
renderer.start();
|
||||
});
|
||||
|
||||
// Basic double click handler
|
||||
jQuery(canvas).dblclick(function(e) {
|
||||
var pos = jQuery(this).offset();
|
||||
var p = fromScreen({x: e.pageX - pos.left, y: e.pageY - pos.top});
|
||||
selected = layout.nearest(p);
|
||||
node = selected.node;
|
||||
if (node && node.data && node.data.ondoubleclick) {
|
||||
node.data.ondoubleclick();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(canvas).mousemove(function(e) {
|
||||
var pos = jQuery(this).offset();
|
||||
var p = fromScreen({x: e.pageX - pos.left, y: e.pageY - pos.top});
|
||||
|
|
Loading…
Reference in New Issue
Block a user