@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/event",
3
- "version": "2.1.7",
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.7"
25
+ "@leafer/core": "2.1.9"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "2.1.7"
28
+ "@leafer/interface": "2.1.9"
29
29
  }
30
30
  }
@@ -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) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1) // 到达边界时阻止镜像
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) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y) // 到达边界时阻止镜像
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
@@ -22,6 +22,8 @@ export class DragEvent extends PointerEvent implements IDragEvent {
22
22
  static ENTER = 'drag.enter'
23
23
  static LEAVE = 'drag.leave'
24
24
 
25
+ static ANIMATE = 'drag.animate'
26
+
25
27
  readonly moveX: number
26
28
  readonly moveY: number
27
29
  readonly totalX: number
package/types/index.d.ts CHANGED
@@ -74,6 +74,7 @@ declare class DragEvent extends PointerEvent implements IDragEvent {
74
74
  static OUT: string;
75
75
  static ENTER: string;
76
76
  static LEAVE: string;
77
+ static ANIMATE: string;
77
78
  readonly moveX: number;
78
79
  readonly moveY: number;
79
80
  readonly totalX: number;