@leafer-in/editor 1.12.4 → 2.0.1

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.4",
3
+ "version": "2.0.1",
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.4",
38
- "@leafer-ui/core": "^1.12.4",
39
- "@leafer-in/resize": "^1.12.4",
40
- "@leafer-ui/interface": "^1.12.4",
41
- "@leafer-in/interface": "^1.12.4"
37
+ "@leafer-ui/draw": "^2.0.1",
38
+ "@leafer-ui/core": "^2.0.1",
39
+ "@leafer-in/resize": "^2.0.1",
40
+ "@leafer-ui/interface": "^2.0.1",
41
+ "@leafer-in/interface": "^2.0.1"
42
42
  }
43
43
  }
@@ -1,5 +1,5 @@
1
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'
2
+ import { Paint, UI, MatrixHelper, getBoundsData, getMatrixData, BoundsHelper, LeafBoundsHelper, isArray, isString, surfaceType, ColorConvert } from '@leafer-ui/draw'
3
3
 
4
4
  import { IStroker } from '@leafer-in/interface'
5
5
 
@@ -78,8 +78,16 @@ export class Stroker extends UI implements IStroker {
78
78
 
79
79
  data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY)
80
80
 
81
+ if (data.shadow) {
82
+ const shadow = data.shadow[0], { scaleX, scaleY } = this.getRenderScaleData(true, shadow.scaleFixed)
83
+ canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color))
84
+ }
85
+
81
86
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options)
82
87
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options)
88
+
89
+ if (data.shadow) canvas.restore()
90
+
83
91
  }
84
92
  }
85
93
 
@@ -20,7 +20,10 @@ export class InnerEditor implements IInnerEditor {
20
20
  public config: IObject
21
21
 
22
22
  public editor: IEditor
23
- public get editBox(): IEditBox { return this.editor.editBox }
23
+
24
+ protected _editBox: IEditBox
25
+ public get editBox(): IEditBox { return this._editBox || this.editor.editBox } // 编辑框,默认为editor.editBox
26
+ public set editBox(value: IEditBox) { this._editBox = value }
24
27
 
25
28
  public view: IGroup
26
29
 
@@ -102,7 +102,7 @@ export class LineEditTool extends EditTool {
102
102
 
103
103
  onUpdate() {
104
104
  const { editBox } = this, { rotatePoints, resizeLines, resizePoints, rect } = editBox
105
- const line = this.editor.element as ILine
105
+ const line = editBox.target as ILine
106
106
 
107
107
  let fromTo: IFromToData, leftOrRight: boolean
108
108
  if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path)
package/types/index.d.ts CHANGED
@@ -322,7 +322,9 @@ declare class InnerEditor implements IInnerEditor {
322
322
  editTarget: IUI;
323
323
  config: IObject;
324
324
  editor: IEditor;
325
+ protected _editBox: IEditBox;
325
326
  get editBox(): IEditBox;
327
+ set editBox(value: IEditBox);
326
328
  view: IGroup;
327
329
  eventIds: IEventListenerId[];
328
330
  constructor(editor: IEditor);