@leafer-ui/export
Advanced tools
+4
-4
| { | ||
| "name": "@leafer-ui/export", | ||
| "version": "1.0.0-rc.17", | ||
| "version": "1.0.0-rc.18", | ||
| "description": "@leafer-ui/export", | ||
@@ -25,8 +25,8 @@ "author": "Chao (Leafer) Wan", | ||
| "dependencies": { | ||
| "@leafer/core": "1.0.0-rc.17" | ||
| "@leafer/core": "1.0.0-rc.18" | ||
| }, | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.0.0-rc.17", | ||
| "@leafer-ui/interface": "1.0.0-rc.17" | ||
| "@leafer/interface": "1.0.0-rc.18", | ||
| "@leafer-ui/interface": "1.0.0-rc.18" | ||
| } | ||
| } |
+13
-6
@@ -1,2 +0,2 @@ | ||
| import { IExportFileType, IFunction, IRenderOptions, IBoundsData, IBounds, ILocationType } from '@leafer/interface' | ||
| import { IExportFileType, IFunction, IRenderOptions, IBoundsData, IBounds, ILocationType, ILeaf } from '@leafer/interface' | ||
| import { Creator, Matrix, TaskProcessor, FileHelper, Bounds } from '@leafer/core' | ||
@@ -42,3 +42,3 @@ | ||
| } else { | ||
| const location: ILocationType = options.location || ((isLeafer || isFrame) ? 'inner' : 'local') | ||
| let relative: ILocationType | ILeaf = options.relative || (isLeafer ? 'inner' : 'local') | ||
@@ -48,3 +48,3 @@ scaleX = worldTransform.scaleX | ||
| switch (location) { | ||
| switch (relative) { | ||
| case 'inner': | ||
@@ -62,10 +62,17 @@ matrix.set(worldTransform).invert() | ||
| break | ||
| case 'page': | ||
| relative = leaf.leafer | ||
| default: | ||
| matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert() | ||
| const l = relative.worldTransform | ||
| scaleX /= scaleX / l.scaleX | ||
| scaleY /= scaleY / l.scaleY | ||
| } | ||
| renderBounds = leaf.getBounds('render', location) | ||
| renderBounds = leaf.getBounds('render', relative) | ||
| } | ||
| const { x, y, width, height } = new Bounds(renderBounds).scale(scale).ceil() | ||
| const { x, y, width, height } = new Bounds(renderBounds).scale(scale) | ||
| let canvas = Creator.canvas({ width, height, pixelRatio }) | ||
| let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio }) | ||
| const renderOptions: IRenderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) } | ||
@@ -72,0 +79,0 @@ |
8643
5.92%119
6.25%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated