@leafer-ui/event 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/DragBoundsHelper.ts +16 -4
- package/src/DragEvent.ts +2 -0
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/event",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "@leafer-ui/event",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "2.1.
|
|
25
|
+
"@leafer/core": "2.1.9"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "2.1.
|
|
28
|
+
"@leafer/interface": "2.1.9"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/DragBoundsHelper.ts
CHANGED
|
@@ -71,8 +71,8 @@ export const DragBoundsHelper = {
|
|
|
71
71
|
tempDragBounds.set(dragBounds)
|
|
72
72
|
tempContent.set(content).scaleOf(origin, scale.x, scale.y)
|
|
73
73
|
|
|
74
|
-
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale
|
|
75
|
-
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale
|
|
74
|
+
const originLeftScale = float((origin.x - content.x) / content.width), originRightScale = float(1 - originLeftScale)
|
|
75
|
+
const originTopScale = float((origin.y - content.y) / content.height), originBottomScale = float(1 - originTopScale)
|
|
76
76
|
|
|
77
77
|
let correctScaleX = 1, correctScaleY = 1, aScale: number, bScale: number, aSize: number, bSize: number
|
|
78
78
|
|
|
@@ -90,7 +90,13 @@ export const DragBoundsHelper = {
|
|
|
90
90
|
} else { // outer 模式
|
|
91
91
|
|
|
92
92
|
if (scale.x < 0) {
|
|
93
|
-
if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0)
|
|
93
|
+
if (float(minX(content) - minX(dragBounds), 2) <= 0 || float(maxX(dragBounds) - maxX(content), 2) <= 0) {
|
|
94
|
+
tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1) // 到达边界时阻止镜像
|
|
95
|
+
if (tempContent.width > 1) {
|
|
96
|
+
correctScaleX *= 1 / tempContent.width
|
|
97
|
+
tempContent.width = 1
|
|
98
|
+
}
|
|
99
|
+
}
|
|
94
100
|
tempContent.unsign()
|
|
95
101
|
}
|
|
96
102
|
|
|
@@ -124,7 +130,13 @@ export const DragBoundsHelper = {
|
|
|
124
130
|
} else { // outer 模式
|
|
125
131
|
|
|
126
132
|
if (scale.y < 0) {
|
|
127
|
-
if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0)
|
|
133
|
+
if (float(minY(content) - minY(dragBounds), 2) <= 0 || float(maxY(dragBounds) - maxY(content), 2) <= 0) {
|
|
134
|
+
tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y) // 到达边界时阻止镜像
|
|
135
|
+
if (tempContent.height > 1) {
|
|
136
|
+
correctScaleY *= 1 / tempContent.height
|
|
137
|
+
tempContent.height = 1
|
|
138
|
+
}
|
|
139
|
+
}
|
|
128
140
|
tempContent.unsign()
|
|
129
141
|
}
|
|
130
142
|
|
package/src/DragEvent.ts
CHANGED
package/types/index.d.ts
CHANGED