@leapfrog/interactive-canvas 2.0.20-beta-4 → 2.0.20-beta-5

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.
@@ -1067,7 +1067,7 @@ class BackgroundImage extends AbstractCanvasObject {
1067
1067
  scaleX: widthPx / this.fabricObject.width,
1068
1068
  scaleY: heightPx / this.fabricObject.height
1069
1069
  });
1070
- this.fabricObject.sendToBack();
1070
+ this.canvas.sendObjectToBack(this.fabricObject);
1071
1071
  this.updateDimensions();
1072
1072
  }
1073
1073
  /**
@@ -1778,7 +1778,7 @@ class Text extends AbstractCanvasObject {
1778
1778
  this.textSelection$ = new BehaviorSubject(new TextSelection(this.fabricObject, this.fontLibrary));
1779
1779
  this.fabricObject.set({ strokeWidth: 0 });
1780
1780
  this.fabricObject.on("text:changed", () => this.onTextChange());
1781
- this.fabricObject.on("text:selection:changed", () => this.onSelectionChange());
1781
+ this.fabricObject.on("selection:changed", () => this.onSelectionChange());
1782
1782
  this.applyBulletListMonkeyPatches();
1783
1783
  }
1784
1784
  /**
@@ -2045,7 +2045,7 @@ class Text extends AbstractCanvasObject {
2045
2045
  else {
2046
2046
  this.fabricObject.set({ textBackgroundColor: color });
2047
2047
  }
2048
- this.fabricObject.set('dirty', true);
2048
+ this.fabricObject.dirty = true;
2049
2049
  this.redraw();
2050
2050
  this.updateTextSelection();
2051
2051
  }
@@ -2103,7 +2103,7 @@ class Text extends AbstractCanvasObject {
2103
2103
  * @inheritDoc
2104
2104
  */
2105
2105
  setBackgroundColor(color) {
2106
- this.fabricObject.set("backgroundColor", color);
2106
+ this.fabricObject.set({ "backgroundColor": color });
2107
2107
  this.redraw();
2108
2108
  }
2109
2109
  /**
@@ -2184,9 +2184,11 @@ class Text extends AbstractCanvasObject {
2184
2184
  enterEditing() {
2185
2185
  if (!this.isEditing()) {
2186
2186
  this.fabricObject.enterEditing();
2187
- this.focus();
2188
- this.selectAllText();
2189
- this.redraw();
2187
+ setTimeout(() => {
2188
+ this.focus();
2189
+ this.selectAllText();
2190
+ this.redraw();
2191
+ }, 0);
2190
2192
  }
2191
2193
  }
2192
2194
  /**
@@ -3826,9 +3828,10 @@ class InteractiveCanvas extends AbstractInteractiveCanvas {
3826
3828
  this.enterTextSelectionModeIfRequired();
3827
3829
  }
3828
3830
  enterTextSelectionModeIfRequired() {
3831
+ var _a, _b;
3829
3832
  if (!this.profile$.value.enterTextEditImmediatelyOnSelect && !this.layoutManager$.value.enterTextEditImmediatelyOnSelect)
3830
3833
  return;
3831
- if (!this.selection$.value || !this.selection$.value.objects[0] || this.selection$.value.objects[0].getType() !== ObjectType.TEXT)
3834
+ if (((_b = (_a = this.selection$.value) === null || _a === void 0 ? void 0 : _a.objects[0]) === null || _b === void 0 ? void 0 : _b.getType()) !== ObjectType.TEXT)
3832
3835
  return;
3833
3836
  const text = this.selection$.value.objects[0];
3834
3837
  text.enterEditing();
@@ -1088,7 +1088,7 @@ class BackgroundImage extends AbstractCanvasObject {
1088
1088
  scaleX: widthPx / this.fabricObject.width,
1089
1089
  scaleY: heightPx / this.fabricObject.height
1090
1090
  });
1091
- this.fabricObject.sendToBack();
1091
+ this.canvas.sendObjectToBack(this.fabricObject);
1092
1092
  this.updateDimensions();
1093
1093
  }
1094
1094
  /**
@@ -1799,7 +1799,7 @@ class Text extends AbstractCanvasObject {
1799
1799
  this.textSelection$ = new rxjs.BehaviorSubject(new TextSelection(this.fabricObject, this.fontLibrary));
1800
1800
  this.fabricObject.set({ strokeWidth: 0 });
1801
1801
  this.fabricObject.on("text:changed", () => this.onTextChange());
1802
- this.fabricObject.on("text:selection:changed", () => this.onSelectionChange());
1802
+ this.fabricObject.on("selection:changed", () => this.onSelectionChange());
1803
1803
  this.applyBulletListMonkeyPatches();
1804
1804
  }
1805
1805
  /**
@@ -2066,7 +2066,7 @@ class Text extends AbstractCanvasObject {
2066
2066
  else {
2067
2067
  this.fabricObject.set({ textBackgroundColor: color });
2068
2068
  }
2069
- this.fabricObject.set('dirty', true);
2069
+ this.fabricObject.dirty = true;
2070
2070
  this.redraw();
2071
2071
  this.updateTextSelection();
2072
2072
  }
@@ -2124,7 +2124,7 @@ class Text extends AbstractCanvasObject {
2124
2124
  * @inheritDoc
2125
2125
  */
2126
2126
  setBackgroundColor(color) {
2127
- this.fabricObject.set("backgroundColor", color);
2127
+ this.fabricObject.set({ "backgroundColor": color });
2128
2128
  this.redraw();
2129
2129
  }
2130
2130
  /**
@@ -2205,9 +2205,11 @@ class Text extends AbstractCanvasObject {
2205
2205
  enterEditing() {
2206
2206
  if (!this.isEditing()) {
2207
2207
  this.fabricObject.enterEditing();
2208
- this.focus();
2209
- this.selectAllText();
2210
- this.redraw();
2208
+ setTimeout(() => {
2209
+ this.focus();
2210
+ this.selectAllText();
2211
+ this.redraw();
2212
+ }, 0);
2211
2213
  }
2212
2214
  }
2213
2215
  /**
@@ -3847,9 +3849,10 @@ class InteractiveCanvas extends AbstractInteractiveCanvas {
3847
3849
  this.enterTextSelectionModeIfRequired();
3848
3850
  }
3849
3851
  enterTextSelectionModeIfRequired() {
3852
+ var _a, _b;
3850
3853
  if (!this.profile$.value.enterTextEditImmediatelyOnSelect && !this.layoutManager$.value.enterTextEditImmediatelyOnSelect)
3851
3854
  return;
3852
- if (!this.selection$.value || !this.selection$.value.objects[0] || this.selection$.value.objects[0].getType() !== exports.ObjectType.TEXT)
3855
+ if (((_b = (_a = this.selection$.value) === null || _a === void 0 ? void 0 : _a.objects[0]) === null || _b === void 0 ? void 0 : _b.getType()) !== exports.ObjectType.TEXT)
3853
3856
  return;
3854
3857
  const text = this.selection$.value.objects[0];
3855
3858
  text.enterEditing();
@@ -1,8 +1,26 @@
1
1
  import { ExtendedFabricObject } from "./extended-fabric-object.interface";
2
2
  import * as fabric from "fabric";
3
- export interface ExtendedFabricTextbox extends Omit<fabric.Textbox, keyof ExtendedFabricObject>, ExtendedFabricObject {
3
+ import { TEvent, TPointerEvent } from "fabric";
4
+ export interface ExtendedFabricTextbox extends fabric.Textbox, ExtendedFabricObject {
4
5
  _isOrderedList?: boolean;
5
6
  _orderedListStart?: number;
6
7
  _orderedListMarkerEntities?: fabric.Textbox[];
7
8
  _bullets?: Record<number, fabric.Object>;
9
+ _setFillStyles(ctx: CanvasRenderingContext2D, { fill }: Pick<this, 'fill'>): any;
10
+ _setStrokeStyles(ctx: CanvasRenderingContext2D, decl: Pick<this, 'stroke' | 'strokeWidth' | 'strokeLineCap' | 'strokeDashOffset' | 'strokeLineJoin' | 'strokeMiterLimit'>): any;
11
+ fire(eventName: string, options?: any): any;
12
+ off(eventName?: any, handler?: (e: TEvent) => void): any;
13
+ on: any;
14
+ onDeselect: any;
15
+ once: any;
16
+ renderDragSourceEffect(_e: DragEvent): void;
17
+ renderDragSourceEffect(): void;
18
+ set(options: Partial<this>): any;
19
+ shouldStartDragging(_e: TPointerEvent): boolean;
20
+ shouldStartDragging(): boolean;
21
+ toObject(propertiesToInclude?: string[]): any;
22
+ toObject<T extends Omit<Partial<any>, keyof any>, K extends keyof T = never>(propertiesToInclude?: K[]): Pick<any, any>;
23
+ type: string;
24
+ selectAll(): any;
25
+ exitEditing(): any;
8
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.20-beta-4",
3
+ "version": "2.0.20-beta-5",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"