@leafer-ui/interaction 1.3.3 → 1.4.1

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/interaction",
3
- "version": "1.3.3",
3
+ "version": "1.4.1",
4
4
  "description": "@leafer-ui/interaction",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.3.3",
26
- "@leafer-ui/draw": "1.3.3",
27
- "@leafer-ui/event": "1.3.3"
25
+ "@leafer/core": "1.4.1",
26
+ "@leafer-ui/draw": "1.4.1",
27
+ "@leafer-ui/event": "1.4.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.3.3",
31
- "@leafer-ui/interface": "1.3.3"
30
+ "@leafer/interface": "1.4.1",
31
+ "@leafer-ui/interface": "1.4.1"
32
32
  }
33
33
  }
@@ -1,5 +1,5 @@
1
1
  import { IUIEvent, IPointerEvent, ILeaf, IInteraction, IInteractionConfig, ITransformer, ILeafList, IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, ISelector, IBounds, IEventListenerId, IInteractionCanvas, ITimer, IKeepTouchData, IKeyEvent, IPickOptions, ICursorType, IBooleanMap, IPickBottom, IClientPointData, IPointData, ILeaferConfig, IMoveConfig, IPointerConfig } from '@leafer/interface'
2
- import { LeaferEvent, ResizeEvent, LeafList, Bounds, PointHelper, DataHelper } from '@leafer/core'
2
+ import { LeaferEvent, ResizeEvent, LeafList, Bounds, PointHelper, DataHelper, Platform } from '@leafer/core'
3
3
 
4
4
  import { IApp } from '@leafer-ui/interface'
5
5
  import { PointerEvent, DropEvent, KeyEvent, PointerButton, Keyboard } from '@leafer-ui/event'
@@ -132,11 +132,10 @@ export class InteractionBase implements IInteraction {
132
132
  }
133
133
 
134
134
  public pointerMoveReal(data: IPointerEvent): void {
135
- const { dragHover, dragDistance } = this.p
136
135
  this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath)
137
136
 
138
137
  if (this.downData) {
139
- const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance
138
+ const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance
140
139
  if (canDrag) {
141
140
  if (this.waitTap) this.pointerWaitCancel()
142
141
  this.waitRightTap = false
@@ -151,9 +150,9 @@ export class InteractionBase implements IInteraction {
151
150
 
152
151
  this.emit(PointerEvent.MOVE, data)
153
152
 
154
- if (!(this.dragging && !dragHover)) this.pointerHover(data)
153
+ this.pointerHover(data)
155
154
 
156
- if (this.dragger.dragging) {
155
+ if (this.dragging) {
157
156
  this.dragger.dragOverOrOut(data)
158
157
  this.dragger.dragEnterOrLeave(data)
159
158
  }
@@ -266,7 +265,8 @@ export class InteractionBase implements IInteraction {
266
265
 
267
266
  // helper
268
267
  protected pointerHover(data: IPointerEvent): void {
269
- if (this.canHover) {
268
+ if (this.canHover && !(this.dragging && !this.p.dragHover)) {
269
+ data.path || (data.path = new LeafList()) // 离开画布的情况
270
270
  this.pointerOverOrOut(data)
271
271
  this.pointerEnterOrLeave(data)
272
272
  }
@@ -353,7 +353,8 @@ export class InteractionBase implements IInteraction {
353
353
  // update
354
354
  public findPath(data: IPointerEvent, options?: IPickOptions): ILeafList {
355
355
  const { hitRadius, through } = this.p
356
- const { bottomList } = this
356
+ const { bottomList, target } = this
357
+ if (!Platform.backgrounder && !data.origin) target && target.updateLayout() // 模拟交互
357
358
  const find = this.selector.getByPoint(data, hitRadius, { bottomList, name: data.type, ...(options || { through }) })
358
359
  if (find.throughPath) data.throughPath = find.throughPath
359
360
  data.path = find.path