@leafer-ui/app 1.0.0-beta → 1.0.0-beta.2
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/Leafer.ts +2 -2
- package/src/type/LeaferType.ts +0 -37
- package/src/type/design.ts +0 -19
- package/src/type/user.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/app",
|
|
3
|
-
"version": "1.0.0-beta",
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "@leafer-ui/app",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/core": "1.0.0-beta",
|
|
23
|
-
"@leafer-ui/display": "1.0.0-beta",
|
|
24
|
-
"@leafer-ui/data": "1.0.0-beta"
|
|
22
|
+
"@leafer/core": "1.0.0-beta.2",
|
|
23
|
+
"@leafer-ui/display": "1.0.0-beta.2",
|
|
24
|
+
"@leafer-ui/data": "1.0.0-beta.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@leafer/interface": "1.0.0-beta",
|
|
28
|
-
"@leafer-ui/interface": "1.0.0-beta"
|
|
27
|
+
"@leafer/interface": "1.0.0-beta.2",
|
|
28
|
+
"@leafer-ui/interface": "1.0.0-beta.2"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/Leafer.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { IApp, ILeafer, ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher
|
|
|
2
2
|
import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, HitCanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ILeaferInputData, ILeaferData } from '@leafer-ui/interface'
|
|
5
|
+
import { LeaferTypeCreator } from '@leafer-ui/type'
|
|
5
6
|
import { LeaferData } from '@leafer-ui/data'
|
|
6
7
|
import { Group } from '@leafer-ui/display'
|
|
7
8
|
|
|
8
9
|
import { App } from './App'
|
|
9
|
-
import { LeaferType } from './type/LeaferType'
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
const debug = Debug.get('Leafer')
|
|
@@ -85,7 +85,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
85
85
|
|
|
86
86
|
let start: boolean
|
|
87
87
|
const { config } = this
|
|
88
|
-
|
|
88
|
+
LeaferTypeCreator.run(config.type, this)
|
|
89
89
|
|
|
90
90
|
// render / layout
|
|
91
91
|
this.canvas = Creator.canvas(config)
|
package/src/type/LeaferType.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ILeafer, ILeaferTypeList, ILeaferTypeFunction } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
import { Debug } from '@leafer/core'
|
|
4
|
-
|
|
5
|
-
import { user } from './user'
|
|
6
|
-
import { design } from './design'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const debug = Debug.get('LeaferType')
|
|
10
|
-
|
|
11
|
-
export const LeaferType = {
|
|
12
|
-
|
|
13
|
-
list: {} as ILeaferTypeList,
|
|
14
|
-
|
|
15
|
-
register(name: string, fn: ILeaferTypeFunction): void {
|
|
16
|
-
if (list[name]) {
|
|
17
|
-
debug.error('repeat:', name)
|
|
18
|
-
} else {
|
|
19
|
-
list[name] = fn
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
run(name: string, leafer: ILeafer): void {
|
|
24
|
-
const fn = LeaferType.list[name]
|
|
25
|
-
if (fn) {
|
|
26
|
-
fn(leafer)
|
|
27
|
-
} else {
|
|
28
|
-
debug.error('no', name)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const { list } = LeaferType
|
|
35
|
-
|
|
36
|
-
LeaferType.register('user', user)
|
|
37
|
-
LeaferType.register('design', design)
|
package/src/type/design.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ILeafer } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
import { MoveEvent, ZoomEvent, LeafHelper } from '@leafer/core'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function design(leafer: ILeafer): void {
|
|
7
|
-
const { MOVE } = MoveEvent
|
|
8
|
-
const { ZOOM } = ZoomEvent
|
|
9
|
-
leafer.__eventIds.push(
|
|
10
|
-
leafer.on_(MOVE, (e: MoveEvent) => { LeafHelper.move(leafer.moveLayer, e.moveX, e.moveY) }),
|
|
11
|
-
leafer.on_(ZOOM, (e: ZoomEvent) => {
|
|
12
|
-
const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.config.zoom
|
|
13
|
-
let { scale } = e
|
|
14
|
-
if (scale * scaleX < min) scale = min / scaleX
|
|
15
|
-
else if (scale * scaleX > max) scale = max / scaleX
|
|
16
|
-
if (scale !== 1) LeafHelper.zoomOf(leafer.zoomLayer, e, scale)
|
|
17
|
-
})
|
|
18
|
-
)
|
|
19
|
-
}
|