[yt-svn] commit/yt: MatthewTurk: Add dragging to plot window widgets
Bitbucket
commits-noreply at bitbucket.org
Mon Mar 5 15:46:49 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/dec8925ec7d9/
changeset: dec8925ec7d9
branch: yt
user: MatthewTurk
date: 2012-03-05 04:03:41
summary: Add dragging to plot window widgets
affected #: 1 file
diff -r e10061cae58d131226572b050bf54a2a1fe7889a -r dec8925ec7d941956d53aaebd6764aae6c42afdd yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -145,11 +145,13 @@
id: "img_" + this.id,
width: 400,
height: 400,
+ draggable: false,
},
x: 100,
y: 10,
width: 400,
height: 400,
+ draggable: false,
listeners: {
afterrender: function(c){
c.el.on('click', function(e){
@@ -163,6 +165,25 @@
yt_rpc.ExtDirectREPL.execute(
{code:cc, hide:true}, cell_finished);
});
+ c.el.on('mousedown', function(e){
+ c.drag_start = true;
+ c.drag_start_pos = e.getXY();
+ });
+ c.el.on('mouseup', function(e){
+ c.drag_start = false;
+ drag_stop = e.getXY();
+ delta_x = drag_stop[0] - c.drag_start_pos[0];
+ delta_y = drag_stop[1] - c.drag_start_pos[1];
+ if (((delta_x < -10) || (delta_x > 10)) ||
+ ((delta_y < -10) || (delta_y > 10))) {
+ rel_x = -delta_x / 400;
+ rel_y = -delta_y / 400;
+ cc = python_varname + '.pan_rel((' +
+ rel_x + ',' + rel_y + '))';
+ yt_rpc.ExtDirectREPL.execute(
+ {code:cc, hide:true}, cell_finished);
+ }
+ });
}
}
}, {
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list