@leafer-ui/app 1.0.0-bate → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/app",
3
- "version": "1.0.0-bate",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "@leafer-ui/app",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,11 +19,12 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/core": "1.0.0-bate",
23
- "@leafer-ui/display": "1.0.0-bate"
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"
24
25
  },
25
26
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-bate",
27
- "@leafer-ui/interface": "1.0.0-bate"
27
+ "@leafer/interface": "1.0.0-beta.2",
28
+ "@leafer-ui/interface": "1.0.0-beta.2"
28
29
  }
29
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
- LeaferType.run(config.type, this)
88
+ LeaferTypeCreator.run(config.type, this)
89
89
 
90
90
  // render / layout
91
91
  this.canvas = Creator.canvas(config)
@@ -1,36 +0,0 @@
1
- import { ILeafer, ILeaferTypeList, ILeaferTypeFunction } from '@leafer/interface'
2
-
3
- import { Debug } from '@leafer/debug'
4
-
5
- import { user } from './user'
6
- import { design } from './design'
7
-
8
- const debug = Debug.get('LeaferType')
9
-
10
- export const LeaferType = {
11
-
12
- list: {} as ILeaferTypeList,
13
-
14
- register(name: string, fn: ILeaferTypeFunction): void {
15
- if (list[name]) {
16
- debug.error('repeat:', name)
17
- } else {
18
- list[name] = fn
19
- }
20
- },
21
-
22
- run(name: string, leafer: ILeafer): void {
23
- const fn = LeaferType.list[name]
24
- if (fn) {
25
- fn(leafer)
26
- } else {
27
- debug.error('no', name)
28
- }
29
- }
30
-
31
- }
32
-
33
- const { list } = LeaferType
34
-
35
- LeaferType.register('user', user)
36
- LeaferType.register('design', design)
@@ -1,18 +0,0 @@
1
- import { MoveEvent, ZoomEvent, LeafHelper } from '@leafer/core'
2
- import { ILeafer } from '@leafer/interface'
3
-
4
-
5
- export function design(leafer: ILeafer): void {
6
- const { MOVE } = MoveEvent
7
- const { ZOOM } = ZoomEvent
8
- leafer.__eventIds.push(
9
- leafer.on_(MOVE, (e: MoveEvent) => { LeafHelper.move(leafer.moveLayer, e.moveX, e.moveY) }),
10
- leafer.on_(ZOOM, (e: ZoomEvent) => {
11
- const { scaleX } = leafer.zoomLayer.__, { min, max } = leafer.config.zoom
12
- let { scale } = e
13
- if (scale * scaleX < min) scale = min / scaleX
14
- else if (scale * scaleX > max) scale = max / scaleX
15
- if (scale !== 1) LeafHelper.zoomOf(leafer.zoomLayer, e, scale)
16
- })
17
- )
18
- }
package/src/type/user.ts DELETED
@@ -1,7 +0,0 @@
1
- import { ILeafer } from '@leafer/interface'
2
-
3
-
4
- export function user(leafer: ILeafer): void {
5
- const { config } = leafer
6
- config.move.dragOut = false
7
- }