diff layer/Layer.h @ 1547:e6362cf5ff1d

Pass a y-coord, optionally, to Layer::snapToFeatureFrame. This is necessary for BoxLayer which needs to coordinate its snaps with the box it is highlighting for editing. Then in BoxLayer, merge getPointToDrag and getLocalPoints into a single getLocalPoint and use this throughout.
author Chris Cannam
date Thu, 17 Oct 2019 11:12:54 +0100
parents 4f8c72adbf43
children a0b2f3b4dd2f
line wrap: on
line diff
--- a/layer/Layer.h	Thu Oct 17 10:26:21 2019 +0100
+++ b/layer/Layer.h	Thu Oct 17 11:12:54 2019 +0100
@@ -185,6 +185,13 @@
      * would be used in an editing operation through calls to
      * editStart etc.
      *
+     * If ycoord is non-negative, it contains the y coordinate at
+     * which the interaction that prompts this snap is taking place
+     * (e.g. of the mouse press used for a selection action). Layers
+     * that have objects at multiple different heights may choose to
+     * use this information. If the current action has no particular y
+     * coordinate associated with it, ycoord will be passed as -1.
+     *
      * Return true if a suitable feature was found and frame adjusted
      * accordingly.  Return false if no suitable feature was available
      * (and leave frame unmodified).  If returning true, also return
@@ -193,7 +200,8 @@
     virtual bool snapToFeatureFrame(LayerGeometryProvider * /* v */,
                                     sv_frame_t & /* frame */,
                                     int &resolution,
-                                    SnapType /* snap */) const {
+                                    SnapType /* snap */,
+                                    int /* ycoord */) const {
         resolution = 1;
         return false;
     }