@leafer/display-module 1.0.0 → 1.0.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 +6 -6
- package/src/LeafEventer.ts +8 -6
- package/src/LeafMatrix.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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.
|
|
26
|
-
"@leafer/event": "1.0.
|
|
27
|
-
"@leafer/math": "1.0.
|
|
28
|
-
"@leafer/debug": "1.0.
|
|
25
|
+
"@leafer/helper": "1.0.1",
|
|
26
|
+
"@leafer/event": "1.0.1",
|
|
27
|
+
"@leafer/math": "1.0.1",
|
|
28
|
+
"@leafer/debug": "1.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.0.
|
|
31
|
+
"@leafer/interface": "1.0.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/LeafEventer.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { IEventListener,
|
|
1
|
+
import { IEventListener, IEventListenerMap, IEventListenerItem, IEventListenerId, IEvent, IObject, IEventTarget, ILeafEventerModule, IEventOption } from '@leafer/interface'
|
|
2
2
|
import { EventCreator } from '@leafer/platform'
|
|
3
3
|
|
|
4
4
|
const empty = {}
|
|
5
5
|
|
|
6
6
|
export const LeafEventer: ILeafEventerModule = {
|
|
7
7
|
|
|
8
|
-
on(type: string | string[], listener: IEventListener, options?:
|
|
8
|
+
on(type: string | string[], listener: IEventListener, options?: IEventOption): void {
|
|
9
9
|
let capture: boolean, once: boolean
|
|
10
10
|
if (options) {
|
|
11
|
-
if (
|
|
11
|
+
if (options === 'once') {
|
|
12
|
+
once = true
|
|
13
|
+
} else if (typeof options === 'boolean') {
|
|
12
14
|
capture = options
|
|
13
15
|
} else {
|
|
14
16
|
capture = options.capture
|
|
@@ -33,7 +35,7 @@ export const LeafEventer: ILeafEventerModule = {
|
|
|
33
35
|
})
|
|
34
36
|
},
|
|
35
37
|
|
|
36
|
-
off(type?: string | string[], listener?: IEventListener, options?:
|
|
38
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void {
|
|
37
39
|
if (type) {
|
|
38
40
|
|
|
39
41
|
const typeList = typeof type === 'string' ? type.split(' ') : type
|
|
@@ -41,7 +43,7 @@ export const LeafEventer: ILeafEventerModule = {
|
|
|
41
43
|
if (listener) {
|
|
42
44
|
|
|
43
45
|
let capture: boolean
|
|
44
|
-
if (options) capture = typeof options === 'boolean' ? options : options.capture
|
|
46
|
+
if (options) capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture)
|
|
45
47
|
|
|
46
48
|
let events: IEventListenerItem[], index: number
|
|
47
49
|
const map = __getListenerMap(this, capture)
|
|
@@ -76,7 +78,7 @@ export const LeafEventer: ILeafEventerModule = {
|
|
|
76
78
|
|
|
77
79
|
},
|
|
78
80
|
|
|
79
|
-
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?:
|
|
81
|
+
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId {
|
|
80
82
|
if (bind) listener = listener.bind(bind)
|
|
81
83
|
this.on(type, listener, options)
|
|
82
84
|
return { type, current: this, listener, options }
|
package/src/LeafMatrix.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const LeafMatrix: ILeafMatrixModule = {
|
|
|
22
22
|
if (layout.affectScaleOrRotation) {
|
|
23
23
|
|
|
24
24
|
if (layout.scaleChanged || layout.rotationChanged) {
|
|
25
|
-
setLayout(local, data as ILayoutData, null, layout.affectRotation)
|
|
25
|
+
setLayout(local, data as ILayoutData, null, null, layout.affectRotation)
|
|
26
26
|
layout.scaleChanged = layout.rotationChanged = false
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@ export const LeafMatrix: ILeafMatrixModule = {
|
|
|
33
33
|
|
|
34
34
|
if (data.around || data.origin) {
|
|
35
35
|
toPoint(data.around || data.origin, layout.boxBounds, tempPoint)
|
|
36
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, data.
|
|
36
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
}
|