@leafer-in/editor 1.12.1 → 1.12.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-in/editor",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "@leafer-in/editor",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^1.12.1",
38
- "@leafer-ui/core": "^1.12.1",
39
- "@leafer-in/resize": "^1.12.1",
40
- "@leafer-ui/interface": "^1.12.1",
41
- "@leafer-in/interface": "^1.12.1"
37
+ "@leafer-ui/draw": "^1.12.2",
38
+ "@leafer-ui/core": "^1.12.2",
39
+ "@leafer-in/resize": "^1.12.2",
40
+ "@leafer-ui/interface": "^1.12.2",
41
+ "@leafer-in/interface": "^1.12.2"
42
42
  }
43
43
  }
@@ -64,8 +64,8 @@ export class EditSelect extends Group implements IEditSelect {
64
64
  public update(): void {
65
65
  this.hoverStroker.update()
66
66
 
67
- const { stroke, strokeWidth, selectedStyle } = this.editor.mergedConfig
68
- this.targetStroker.update({ stroke, strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2), ...(selectedStyle || {}) })
67
+ const { stroke, strokeWidth, selectedPathType, selectedStyle } = this.editor.mergedConfig
68
+ this.targetStroker.update({ stroke, strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2), strokePathType: selectedPathType, ...(selectedStyle || {}) })
69
69
  }
70
70
 
71
71
  // move / down
@@ -1,5 +1,5 @@
1
- import { IUI, ILeaferCanvas, IRenderOptions, IRectInputData, IMatrixWithOptionHalfData } from '@leafer-ui/interface'
2
- import { Paint, UI, MatrixHelper, getBoundsData, getMatrixData, BoundsHelper, LeafBoundsHelper, isArray, isString } from '@leafer-ui/draw'
1
+ import { IUI, ILeaferCanvas, IRenderOptions, IUIInputData, IMatrixWithOptionHalfData } from '@leafer-ui/interface'
2
+ import { Paint, UI, MatrixHelper, getBoundsData, getMatrixData, BoundsHelper, LeafBoundsHelper, isArray, isString, surfaceType } from '@leafer-ui/draw'
3
3
 
4
4
  import { IStroker } from '@leafer-in/interface'
5
5
 
@@ -20,6 +20,9 @@ export class Stroker extends UI implements IStroker {
20
20
 
21
21
  public list: IUI[] = []
22
22
 
23
+ @surfaceType('render-path')
24
+ public strokePathType: 'path' | 'render-path'
25
+
23
26
  constructor() {
24
27
  super()
25
28
  this.visible = 0
@@ -27,13 +30,13 @@ export class Stroker extends UI implements IStroker {
27
30
  this.strokeAlign = 'center'
28
31
  }
29
32
 
30
- public setTarget(target: IUI | IUI[], style?: IRectInputData): void {
33
+ public setTarget(target: IUI | IUI[], style?: IUIInputData): void {
31
34
  if (style) this.set(style)
32
35
  this.target = target
33
36
  this.update()
34
37
  }
35
38
 
36
- public update(style?: IRectInputData): void {
39
+ public update(style?: IUIInputData): void {
37
40
  const { list } = this
38
41
  if (list.length) {
39
42
  setListWithFn(bounds, list, worldBounds)
@@ -65,8 +68,13 @@ export class Stroker extends UI implements IStroker {
65
68
  canvas.setWorld(matrix, options.matrix)
66
69
  canvas.beginPath()
67
70
 
68
- if (leaf.__.__useArrow) leaf.__drawPath(canvas)
69
- else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas)
71
+
72
+ if (this.strokePathType === 'path') {
73
+ leaf.__drawPath(canvas)
74
+ } else {
75
+ if (leaf.__.__useArrow) leaf.__drawPath(canvas)
76
+ else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas)
77
+ }
70
78
 
71
79
  data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY)
72
80
 
@@ -57,7 +57,7 @@ export class TransformTool implements ITransformTool { // Editor use
57
57
  let { around, lockRatio, flipable, editSize } = mergeConfig, totalMove: IPointData | number
58
58
 
59
59
  if (e instanceof ZoomEvent) {
60
- around = target.getBoxPoint(e)
60
+ if (!around) around = target.getBoxPoint(e)
61
61
  totalMove = e.totalScale
62
62
  } else {
63
63
  totalMove = e.getInnerTotal(target)
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _leafer_ui_interface from '@leafer-ui/interface';
2
- import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, IGroupInputData, IEditSize, IPointData, IAlign, IAxis, IMatrix, IApp, IEditorDragStartData, IEditorConfig as IEditorConfig$1, ITransformTool, IBoundsData, IBoxInputData, IUIEvent, IKeyEvent, IRect, IRectInputData, IMatrixData, IDragEvent, IAround, IEvent, ILayoutBoundsData } from '@leafer-ui/interface';
2
+ import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, IGroupInputData, IEditSize, IPointData, IAlign, IAxis, IMatrix, IApp, IEditorDragStartData, IEditorConfig as IEditorConfig$1, ITransformTool, IBoundsData, IBoxInputData, IUIEvent, IKeyEvent, IRect, IRectInputData, IUIInputData, IMatrixData, IDragEvent, IAround, IEvent, ILayoutBoundsData } from '@leafer-ui/interface';
3
3
  import { Group, UI, Direction9, Box, Event } from '@leafer-ui/draw';
4
4
  import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, RotateEvent, KeyEvent } from '@leafer-ui/core';
5
5
  import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditPoint, ISimulateElement, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditPointType, IEditPointInputData, IEditorEvent, IEditorMoveEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorGroupEvent, IInnerEditorEvent, IInnerEditorMode, IUI as IUI$1, IDragEvent as IDragEvent$1, IPointData as IPointData$1, IPathCommandData, IFromToData, IAround as IAround$1 } from '@leafer-in/interface';
@@ -223,9 +223,10 @@ declare class SelectArea extends Group implements ISelectArea {
223
223
  declare class Stroker extends UI implements IStroker {
224
224
  target: IUI | IUI[];
225
225
  list: IUI[];
226
+ strokePathType: 'path' | 'render-path';
226
227
  constructor();
227
- setTarget(target: IUI | IUI[], style?: IRectInputData): void;
228
- update(style?: IRectInputData): void;
228
+ setTarget(target: IUI | IUI[], style?: IUIInputData): void;
229
+ update(style?: IUIInputData): void;
229
230
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
230
231
  destroy(): void;
231
232
  }