mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Compensate drag for scale
This commit is contained in:
@@ -24,7 +24,8 @@ export default class UDrag extends UMouseClickDrag {
|
||||
|
||||
dragTo(e) {
|
||||
let mousePosition = this.snapToGrid(e.clientX, e.clientY)
|
||||
const d = [mousePosition[0] - this.mousePosition[0], mousePosition[1] - this.mousePosition[1]]
|
||||
let scaleCorrection = 1 / this.target.getScale()
|
||||
const d = [(mousePosition[0] - this.mousePosition[0]) * scaleCorrection, (mousePosition[1] - this.mousePosition[1]) * scaleCorrection]
|
||||
|
||||
if (d[0] == 0 && d[1] == 0) {
|
||||
return
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class UMouseWheel {
|
||||
if (self.looseTarget) {
|
||||
/*
|
||||
* Compensating for having used the mouse wheel over a descendant of the target (the element listened for the 'wheel' event).
|
||||
* We are interested to get the location relative to the listened target, not the exact target that caused the event.
|
||||
* We are interested to get the location relative to the listened target, not the descendant target that caused the event.
|
||||
*/
|
||||
const targetOffset = e.target.getBoundingClientRect()
|
||||
const currentTargetOffset = e.currentTarget.getBoundingClientRect()
|
||||
|
||||
Reference in New Issue
Block a user