Closed MichalK6677 closed 12 months ago
You're right. I fix it to center the handle on the cursor.
There is a problem with solution this.coordinate_ = feature.getGeometry().getCoordinates(); //evt.coordinate
when there is translateFeature: true
Check it here (when you drag the rectangle then it disappears): https://codesandbox.io/s/snap-forked-4ktwhr?file=/main.js
Maybe center or topLeft of the feature extent could be used when translateFeature: true?
I fall back to the previous method when clicking on the feature to move it (i.e. use the pointer position)
I want to use Transform interaction toghether with Snap. Snap works based on cursor position so cursor should always drag center of the handle. It's not the case for Transform interaction and it's even more visible with hitTolerance.
Scenario: I want to resize polygon and snap to predefined points. With hitTolerance e.g. 40, I can drag 40 pixels out of the drag handle. Hence, openlayers does not snap to drag handle but to cursor and it's 40 pixes out.
How it should/could work: When I start drag out of the handle (because of hitTolerance), the drag handle is automatically moved to cursor position.
Here is code example: https://codesandbox.io/s/snap-forked-kpf56q?file=/main.js
You just need to coment/uncoment this section to see the difference:
This is change in code: