@leafer-in/editor 2.0.0 → 2.0.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": "2.0.0",
3
+ "version": "2.0.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": "^2.0.0",
38
- "@leafer-ui/core": "^2.0.0",
39
- "@leafer-in/resize": "^2.0.0",
40
- "@leafer-ui/interface": "^2.0.0",
41
- "@leafer-in/interface": "^2.0.0"
37
+ "@leafer-ui/draw": "^2.0.2",
38
+ "@leafer-ui/core": "^2.0.2",
39
+ "@leafer-in/resize": "^2.0.2",
40
+ "@leafer-ui/interface": "^2.0.2",
41
+ "@leafer-in/interface": "^2.0.2"
42
42
  }
43
43
  }
@@ -125,6 +125,8 @@ export class EditSelect extends Group implements IEditSelect {
125
125
  editor.target = find
126
126
  }
127
127
 
128
+ e.path.needUpdate = true // 需要更新一下path
129
+
128
130
  } else if (this.allow(e.target)) {
129
131
 
130
132
  if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null
@@ -22,6 +22,7 @@ export class SimulateElement extends Rect implements ISimulateElement {
22
22
  super()
23
23
 
24
24
  this.visible = this.hittable = false
25
+ this.skipJSON = true
25
26
 
26
27
  this.on(PropertyEvent.CHANGE, (event: PropertyEvent) => {
27
28
 
@@ -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);