Explorar o código

Properly detect bounding box, and update doc.

Bentley James Oakes %!s(int64=7) %!d(string=hai) anos
pai
achega
d6fae01bfa
Modificáronse 2 ficheiros con 14 adicións e 6 borrados
  1. 10 6
      client/connection_utils.js
  2. 4 0
      doc/overview.rst

+ 10 - 6
client/connection_utils.js

@@ -237,14 +237,18 @@ ConnectionUtils = function(){
             return [x, y];
         }
 
-        let icon = __getIcon(start || end).node;
-        let iconX = parseFloat(icon.getAttribute("__x"));
-        let iconY = parseFloat(icon.getAttribute("__y"));
-
+        //get the bounding box rectangle
+        let icon = __getIcon(start || end);
         let bbox = icon.getBBox();
-        let width = parseFloat(bbox["width"]);
-        let height = parseFloat(bbox["height"]);
 
+        //get the dimensions
+        let iconX = bbox.x;
+        let iconY = bbox.y;
+
+        let width = bbox.width;
+        let height = bbox.height;
+
+        //restrict x and y to within the bounding box
         if (x < iconX) {
             x = iconX;
         } else if (x > iconX + width) {

+ 4 - 0
doc/overview.rst

@@ -226,6 +226,10 @@ When in the **EDGE EDITING** state, |edge_editing|
 | Action                                | Shortcut(s)                                                                 |
 +=======================================+=============================================================================+
 | Move control point                    | Left-press any control point, drag it to desired position and release.      |
+|                                       |                                                                             |
+|                                       | If editing a control point attached to an icon, movement is restricted to   |
+|                                       | within that icon's bounding box. If free movement is desired,               |
+|                                       | hold CTRL while moving the control point.                                   |
 +---------------------------------------+-----------------------------------------------------------------------------+
 | Vertically/Horizontally align control | Left-click any control point and click TAB.                                 |
 | point to previous control point       |                                                                             |