@leafer-ui/display 1.2.0 → 1.2.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 +8 -8
- package/src/Canvas.ts +6 -3
- package/src/Leafer.ts +7 -4
- package/types/index.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.2.
|
|
26
|
-
"@leafer-ui/data": "1.2.
|
|
27
|
-
"@leafer-ui/display-module": "1.2.
|
|
28
|
-
"@leafer-ui/decorator": "1.2.
|
|
29
|
-
"@leafer-ui/external": "1.2.
|
|
25
|
+
"@leafer/core": "1.2.2",
|
|
26
|
+
"@leafer-ui/data": "1.2.2",
|
|
27
|
+
"@leafer-ui/display-module": "1.2.2",
|
|
28
|
+
"@leafer-ui/decorator": "1.2.2",
|
|
29
|
+
"@leafer-ui/external": "1.2.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.2.
|
|
33
|
-
"@leafer-ui/interface": "1.2.
|
|
32
|
+
"@leafer/interface": "1.2.2",
|
|
33
|
+
"@leafer-ui/interface": "1.2.2"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Canvas.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData } from '@leafer/interface'
|
|
2
|
-
import { Creator, ImageEvent, LeaferImage, Matrix, dataProcessor, registerUI } from '@leafer/core'
|
|
2
|
+
import { Creator, ImageEvent, LeaferImage, Matrix, dataProcessor, dataType, registerUI } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
|
|
5
5
|
import { CanvasData } from '@leafer-ui/data'
|
|
@@ -28,6 +28,9 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
28
28
|
@resizeType(true)
|
|
29
29
|
public smooth?: boolean
|
|
30
30
|
|
|
31
|
+
@dataType(false)
|
|
32
|
+
public safeResize?: boolean
|
|
33
|
+
|
|
31
34
|
@resizeType()
|
|
32
35
|
public contextSettings?: ICanvasContext2DSettings
|
|
33
36
|
|
|
@@ -81,9 +84,9 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
81
84
|
public __updateSize(): void {
|
|
82
85
|
const { canvas } = this
|
|
83
86
|
if (canvas) {
|
|
84
|
-
const { smooth } = this.__
|
|
87
|
+
const { smooth, safeResize } = this.__
|
|
88
|
+
canvas.resize(this.__ as IScreenSizeData, safeResize)
|
|
85
89
|
if (canvas.smooth !== smooth) canvas.smooth = smooth
|
|
86
|
-
canvas.resize(this.__ as IScreenSizeData)
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
package/src/Leafer.ts
CHANGED
|
@@ -195,9 +195,12 @@ export class Leafer extends Group implements ILeafer {
|
|
|
195
195
|
Object.keys(data).forEach(key => (this as any)[key] = data[key])
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
override forceRender(bounds?: IBoundsData): void {
|
|
199
|
-
|
|
200
|
-
if (
|
|
198
|
+
override forceRender(bounds?: IBoundsData, sync?: boolean): void {
|
|
199
|
+
const { renderer } = this
|
|
200
|
+
if (renderer) {
|
|
201
|
+
renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds)
|
|
202
|
+
if (this.viewReady) sync ? renderer.render() : renderer.update()
|
|
203
|
+
}
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
public requestRender(change = false): void {
|
|
@@ -315,7 +318,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
315
318
|
this.viewCompleted = false
|
|
316
319
|
this.requestRender()
|
|
317
320
|
}
|
|
318
|
-
}
|
|
321
|
+
} else this.requestRender() // fix: 小程序等需要异步获取 view 的情况
|
|
319
322
|
}
|
|
320
323
|
|
|
321
324
|
protected __checkViewCompleted(emit: boolean = true): void {
|
package/types/index.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
219
219
|
unlockLayout(): void;
|
|
220
220
|
lockLayout(): void;
|
|
221
221
|
resize(size: IScreenSizeData): void;
|
|
222
|
-
forceRender(bounds?: IBoundsData): void;
|
|
222
|
+
forceRender(bounds?: IBoundsData, sync?: boolean): void;
|
|
223
223
|
requestRender(change?: boolean): void;
|
|
224
224
|
updateCursor(cursor?: ICursorType): void;
|
|
225
225
|
updateLazyBounds(): void;
|
|
@@ -363,6 +363,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
363
363
|
height?: INumber;
|
|
364
364
|
pixelRatio?: INumber;
|
|
365
365
|
smooth?: boolean;
|
|
366
|
+
safeResize?: boolean;
|
|
366
367
|
contextSettings?: ICanvasContext2DSettings;
|
|
367
368
|
canvas?: ILeaferCanvas;
|
|
368
369
|
context?: ICanvasContext2D;
|