From 7ed10d631e5ccea43255d767a77aafeeab820634 Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Wed, 14 May 2014 14:22:28 +0100 Subject: [PATCH] Reverse mouse wheel - so canvas (alt) zoom consistent with page (ctrl) zoom --- public/red/ui/view.js | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 0f34c6825..54ea8d1c9 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -47,10 +47,8 @@ RED.view = function() { moveTouchCenter = [], touches = 0; - var clipboard = ""; - var status_colours = { "red": "#c00", "green": "#5a8", @@ -58,7 +56,7 @@ RED.view = function() { "blue": "#53A3F3", "grey": "#d3d3d3" } - + var outer = d3.select("#chart") .append("svg:svg") .attr("width", space_width) @@ -162,7 +160,7 @@ RED.view = function() { startTouchDistance = moveTouchDistance; moveTouchCenter = touchCenter; - + $("#chart").scrollLeft(scrollPos[0]+deltaTouchCenter[0]); $("#chart").scrollTop(scrollPos[1]+deltaTouchCenter[1]); redraw(); @@ -316,7 +314,7 @@ RED.view = function() { //d3.select(window).on("keydown", keydown); function canvasMouseDown() { - + if (!mousedown_node && !mousedown_link) { selected_link = null; updateSelection(); @@ -346,8 +344,8 @@ RED.view = function() { function canvasMouseMove() { mouse_position = d3.touches(this)[0]||d3.mouse(this); - - // Prevent touch scrolling... + + // Prevent touch scrolling... //if (d3.touches(this)[0]) { // d3.event.preventDefault(); //} @@ -528,8 +526,8 @@ RED.view = function() { evt.preventDefault(); evt.stopPropagation(); var move = evt.originalEvent.detail || evt.originalEvent.wheelDelta; - if (move <= 0) { zoomIn(); } - else { zoomOut(); } + if (move <= 0) { zoomOut(); } + else { zoomIn(); } } }); $("#chart").droppable({ @@ -553,11 +551,11 @@ RED.view = function() { for (var d in nn._def.defaults) { nn[d] = nn._def.defaults[d].value; } - + if (nn._def.onadd) { nn._def.onadd.call(nn); } - + nn.h = Math.max(node_height,(nn.outputs||0) * 15); RED.history.push({t:'add',nodes:[nn.id],dirty:dirty}); RED.nodes.add(nn); @@ -668,7 +666,7 @@ RED.view = function() { function moveSelection(dx,dy) { var minX = 0; var minY = 0; - + for (var i=0;i 0) { @@ -1182,7 +1180,7 @@ RED.view = function() { thisNode.selectAll('.node_status_label').text(""); } } - + d.dirty = false; } }); @@ -1260,7 +1258,7 @@ RED.view = function() { RED.keyboard.add(/* i */ 73,{ctrl:true},function(){showImportNodesDialog();d3.event.preventDefault();}); // TODO: 'dirty' should be a property of RED.nodes - with an event callback for ui hooks - function setDirty(d) { + function setDirty(d) {___ dirty = d; if (dirty) { $("#btn-deploy").removeClass("disabled").addClass("btn-danger");