← Back to team overview

yellow team mailing list archive

Fix for rounding error on drag-relation. (issue 6741047)

 

Reviewers: mp+130424_code.launchpad.net,

Message:
Please take a look.

Description:
Fix for rounding error on drag-relation.

New service blocks have integer x/y coordinates, leading to mouseenter
failing at the d.containsPoint() test when one of the mouse coordinates
matched exactly with one of the edges of the service block.  To
reproduce, create two new services (say varnish and node-app) and,
without navigating away from the environment view, drag them to be
diagonal relative to each other, then try to drag a relation from one to
the other through the corner of the service node.  Correct behavior
(this branch) should be for the drag line to snap to the two nearest
connectors (as opposed to passing through the service without
recognizing that it had entered).

https://code.launchpad.net/~makyo/juju-gui/bad-drag/+merge/130424

(do not edit description out of merge proposal)


Please review this at https://codereview.appspot.com/6741047/

Affected files:
   A [revision details]
   M app/views/utils.js


Index: [revision details]
=== added file '[revision details]'
--- [revision details]	2012-01-01 00:00:00 +0000
+++ [revision details]	2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: gary.poster@xxxxxxxxxxxxx-20121018175640-pi9gu13ghgftgw3c
+New revision: matthew.scott@xxxxxxxxxxxxx-20121018201926-xyil8cv1gqayf7io

Index: app/views/utils.js
=== modified file 'app/views/utils.js'
--- app/views/utils.js	2012-10-15 03:22:43 +0000
+++ app/views/utils.js	2012-10-18 20:19:26 +0000
@@ -619,10 +619,10 @@
          translate: function() { return [0, 0]; }
        };
        var s = transform.scale(), tr = transform.translate();
-      if (point[0] > this.x * s + tr[0] &&
-          point[0] < this.x * s + this.w * s + tr[0] &&
-          point[1] > this.y * s + tr[1] &&
-          point[1] < this.y * s + this.h * s + tr[1]) {
+      if (point[0] >= this.x * s + tr[0] &&
+          point[0] <= this.x * s + this.w * s + tr[0] &&
+          point[1] >= this.y * s + tr[1] &&
+          point[1] <= this.y * s + this.h * s + tr[1]) {
          return true;
        }
        return false;





-- 
https://code.launchpad.net/~makyo/juju-gui/bad-drag/+merge/130424
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~makyo/juju-gui/bad-drag into lp:juju-gui.


References