@leafer/node 1.0.0-beta → 1.0.0-beta.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/node",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "@leafer/node",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -4,11 +4,11 @@ export * from '@leafer/partner'
4
4
  export * from '@leafer/canvas-node'
5
5
  export * from '@leafer/image-web'
6
6
 
7
- import { ICreator, IFunction } from '@leafer/interface'
7
+ import { ICreator, IFunction, IObject } from '@leafer/interface'
8
8
  import { Platform, Creator } from '@leafer/core'
9
9
 
10
10
  import { LeaferCanvas } from '@leafer/canvas-node'
11
- import { LeaferImage } from '@leafer/image-web'
11
+ import { LeaferImage } from '@leafer/image-node'
12
12
  import { InteractionBase } from '@leafer/interaction'
13
13
 
14
14
 
@@ -20,6 +20,15 @@ Object.assign(Creator, {
20
20
  interaction: (target, canvas, selector, options?) => { return new InteractionBase(target, canvas, selector, options) }
21
21
  } as ICreator)
22
22
 
23
- Platform.requestRender = function (render: IFunction): void { window.requestAnimationFrame(render) }
24
- Platform.canvas = Creator.canvas()
25
- Platform.devicePixelRatio = devicePixelRatio
23
+ Platform.requestRender = function (render: IFunction): void { setTimeout(render) }
24
+ Platform.devicePixelRatio = devicePixelRatio
25
+ Platform.conicGradientSupport = true
26
+
27
+ export function useSkiaCanvas(skia: IObject): void {
28
+ const { Canvas, loadImage } = skia
29
+ Platform.origin = {
30
+ createCanvas: (width: number, height: number) => new Canvas(width, height),
31
+ loadImage
32
+ }
33
+ Platform.canvas = Creator.canvas()
34
+ }