@leafer/display-module 1.0.0-rc.22 → 1.0.0-rc.23

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/display-module",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.23",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/helper": "1.0.0-rc.22",
26
- "@leafer/event": "1.0.0-rc.22",
27
- "@leafer/math": "1.0.0-rc.22",
28
- "@leafer/debug": "1.0.0-rc.22"
25
+ "@leafer/helper": "1.0.0-rc.23",
26
+ "@leafer/event": "1.0.0-rc.23",
27
+ "@leafer/math": "1.0.0-rc.23",
28
+ "@leafer/debug": "1.0.0-rc.23"
29
29
  },
30
30
  "devDependencies": {
31
- "@leafer/interface": "1.0.0-rc.22"
31
+ "@leafer/interface": "1.0.0-rc.23"
32
32
  }
33
33
  }
@@ -22,6 +22,8 @@ export const BranchRender: IBranchRenderModule = {
22
22
 
23
23
  if (this.__.__single) {
24
24
 
25
+ if (this.__.eraser === 'path') return this.__renderEraser(canvas, options)
26
+
25
27
  const tempCanvas = canvas.getSameCanvas(false, true)
26
28
 
27
29
  this.__renderBranch(tempCanvas, options)
package/src/LeafBounds.ts CHANGED
@@ -131,6 +131,9 @@ export const LeafBounds: ILeafBoundsModule = {
131
131
  this.__layout.matrixChanged = true
132
132
  if (this.isBranch) {
133
133
  if (this.leafer) this.leafer.layouter.addExtra(this) // add part render
134
+ if (this.__.flow) this.__updateFlowLayout()
135
+ // console.log('update flow')
136
+
134
137
  if (hasParentAutoLayout(this)) {
135
138
  updateMatrix(this)
136
139
  } else {
@@ -33,24 +33,47 @@ export const LeafEventer: ILeafEventerModule = {
33
33
  })
34
34
  },
35
35
 
36
- off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void {
37
- let capture: boolean
38
- if (options) capture = typeof options === 'boolean' ? options : options.capture
36
+ off(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void {
37
+ if (type) {
39
38
 
40
- let events: IEventListenerItem[], index: number
41
- const map = __getListenerMap(this, capture)
42
- const typeList = typeof type === 'string' ? type.split(' ') : type
39
+ const typeList = typeof type === 'string' ? type.split(' ') : type
40
+
41
+ if (listener) {
42
+
43
+ let capture: boolean
44
+ if (options) capture = typeof options === 'boolean' ? options : options.capture
45
+
46
+ let events: IEventListenerItem[], index: number
47
+ const map = __getListenerMap(this, capture)
48
+
49
+ typeList.forEach(type => {
50
+ if (type) {
51
+ events = map[type]
52
+ if (events) {
53
+ index = events.findIndex(item => item.listener === listener)
54
+ if (index > -1) events.splice(index, 1)
55
+ if (!events.length) delete map[type]
56
+ }
57
+ }
58
+ })
59
+
60
+ } else {
61
+
62
+ // off type
63
+ const { __bubbleMap: b, __captureMap: c } = this
64
+ typeList.forEach(type => {
65
+ if (b) delete b[type]
66
+ if (c) delete c[type]
67
+ })
43
68
 
44
- typeList.forEach(type => {
45
- if (type) {
46
- events = map[type]
47
- if (events) {
48
- index = events.findIndex(item => item.listener === listener)
49
- if (index > -1) events.splice(index, 1)
50
- if (!events.length) delete map[type]
51
- }
52
69
  }
53
- })
70
+
71
+ } else {
72
+
73
+ this.__bubbleMap = this.__captureMap = undefined // off all
74
+
75
+ }
76
+
54
77
  },
55
78
 
56
79
  on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId {
package/src/LeafMatrix.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeafMatrixModule, ILayoutData } from '@leafer/interface'
1
+ import { ILeafMatrixModule, ILayoutData, IScrollPointData } from '@leafer/interface'
2
2
  import { AroundHelper, MatrixHelper } from '@leafer/math'
3
3
 
4
4
 
@@ -9,7 +9,7 @@ export const LeafMatrix: ILeafMatrixModule = {
9
9
 
10
10
  __updateWorldMatrix(): void {
11
11
 
12
- multiplyParent(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__ as ILayoutData)
12
+ multiplyParent(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__ as ILayoutData, this.parent && this.parent.__ as IScrollPointData)
13
13
 
14
14
  },
15
15
 
@@ -28,12 +28,12 @@ export const LeafMatrix: ILeafMatrixModule = {
28
28
 
29
29
  }
30
30
 
31
- local.e = data.x
32
- local.f = data.y
31
+ local.e = data.x + data.offsetX
32
+ local.f = data.y + data.offsetY
33
33
 
34
- if (data.around) {
35
- toPoint(data.around, layout.boxBounds, tempPoint)
36
- translateInner(local, -tempPoint.x, -tempPoint.y)
34
+ if (data.around || data.origin) {
35
+ toPoint(data.around || data.origin, layout.boxBounds, tempPoint)
36
+ translateInner(local, -tempPoint.x, -tempPoint.y, data.origin as unknown as boolean)
37
37
  }
38
38
 
39
39
  }
package/src/LeafRender.ts CHANGED
@@ -11,6 +11,8 @@ export const LeafRender: ILeafRenderModule = {
11
11
 
12
12
  if (this.__.__single) {
13
13
 
14
+ if (this.__.eraser === 'path') return this.__renderEraser(canvas, options)
15
+
14
16
  const tempCanvas = canvas.getSameCanvas(true, true)
15
17
  this.__draw(tempCanvas, options)
16
18