@leapfrog/interactive-canvas 2.0.20-beta-2 → 2.0.20-beta-3

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.
@@ -2476,12 +2476,8 @@ class Text extends AbstractCanvasObject {
2476
2476
  text: `${lineNumber}.`
2477
2477
  });
2478
2478
  }
2479
- console.log(this.fabricObject.left, "this.fabricObject.left");
2480
- console.log(left, "left");
2481
2479
  if (method === "fillText" && this.fabricObject.left <= 3) {
2482
2480
  left = left + this.getOrderedListMargin();
2483
- console.log(this.getOrderedListMargin(), "this.getOrderedListMargin()");
2484
- console.log(left, "after marginleft");
2485
2481
  }
2486
2482
  this.fabricObject.dirty = true;
2487
2483
  originalRenderTextLine.apply(this.fabricObject, [method, ctx, Array.isArray(line) ? line : [line], left, top, lineIndex]);
@@ -3362,6 +3358,8 @@ class AbstractInteractiveCanvas {
3362
3358
  }
3363
3359
  setMultiSelect(value) {
3364
3360
  this.fabricCanvas.selection = value;
3361
+ this.fabricCanvas.selectionColor = value ? "rgba(0,0,0,0.1)" : "transparent"; // Adjust selection color
3362
+ this.fabricCanvas.selectionBorderColor = "transparent";
3365
3363
  this.fabricCanvas.selectionKey = value ? "shiftKey" : null;
3366
3364
  }
3367
3365
  /**
@@ -3603,7 +3601,12 @@ class AbstractInteractiveCanvas {
3603
3601
  }
3604
3602
  findObject(id) {
3605
3603
  //Don't use strict compare here. fabric ids are numbers while ad builder ids are strings... mostly.
3606
- return _.find(this.objects$.value, (object) => object.getId() == id);
3604
+ //return _.find(this.objects$.value, (object: AbstractCanvasObject<any>) => object.getId() == id)!;
3605
+ const foundObject = _.find(this.objects$.value, (object) => object.getId() == id);
3606
+ if (!foundObject) {
3607
+ throw new Error(`Object with id [${id}] not found`);
3608
+ }
3609
+ return foundObject;
3607
3610
  }
3608
3611
  /**
3609
3612
  * Reset zoom and canvas dimensions to 1:1 scale, execute a function, then return the canvas to
@@ -3684,6 +3687,7 @@ class AbstractInteractiveCanvas {
3684
3687
  class SelectionData {
3685
3688
  constructor(objects) {
3686
3689
  this.objects = objects;
3690
+ console.log(objects[0], "objects");
3687
3691
  this.empty = this.objects.length < 1;
3688
3692
  const selectedObject = this.objects[0];
3689
3693
  this.isText = (selectedObject === null || selectedObject === void 0 ? void 0 : selectedObject.getType()) === ObjectType.TEXT
@@ -2497,12 +2497,8 @@ class Text extends AbstractCanvasObject {
2497
2497
  text: `${lineNumber}.`
2498
2498
  });
2499
2499
  }
2500
- console.log(this.fabricObject.left, "this.fabricObject.left");
2501
- console.log(left, "left");
2502
2500
  if (method === "fillText" && this.fabricObject.left <= 3) {
2503
2501
  left = left + this.getOrderedListMargin();
2504
- console.log(this.getOrderedListMargin(), "this.getOrderedListMargin()");
2505
- console.log(left, "after marginleft");
2506
2502
  }
2507
2503
  this.fabricObject.dirty = true;
2508
2504
  originalRenderTextLine.apply(this.fabricObject, [method, ctx, Array.isArray(line) ? line : [line], left, top, lineIndex]);
@@ -3383,6 +3379,8 @@ class AbstractInteractiveCanvas {
3383
3379
  }
3384
3380
  setMultiSelect(value) {
3385
3381
  this.fabricCanvas.selection = value;
3382
+ this.fabricCanvas.selectionColor = value ? "rgba(0,0,0,0.1)" : "transparent"; // Adjust selection color
3383
+ this.fabricCanvas.selectionBorderColor = "transparent";
3386
3384
  this.fabricCanvas.selectionKey = value ? "shiftKey" : null;
3387
3385
  }
3388
3386
  /**
@@ -3624,7 +3622,12 @@ class AbstractInteractiveCanvas {
3624
3622
  }
3625
3623
  findObject(id) {
3626
3624
  //Don't use strict compare here. fabric ids are numbers while ad builder ids are strings... mostly.
3627
- return _.find(this.objects$.value, (object) => object.getId() == id);
3625
+ //return _.find(this.objects$.value, (object: AbstractCanvasObject<any>) => object.getId() == id)!;
3626
+ const foundObject = _.find(this.objects$.value, (object) => object.getId() == id);
3627
+ if (!foundObject) {
3628
+ throw new Error(`Object with id [${id}] not found`);
3629
+ }
3630
+ return foundObject;
3628
3631
  }
3629
3632
  /**
3630
3633
  * Reset zoom and canvas dimensions to 1:1 scale, execute a function, then return the canvas to
@@ -3705,6 +3708,7 @@ class AbstractInteractiveCanvas {
3705
3708
  class SelectionData {
3706
3709
  constructor(objects) {
3707
3710
  this.objects = objects;
3711
+ console.log(objects[0], "objects");
3708
3712
  this.empty = this.objects.length < 1;
3709
3713
  const selectedObject = this.objects[0];
3710
3714
  this.isText = (selectedObject === null || selectedObject === void 0 ? void 0 : selectedObject.getType()) === exports.ObjectType.TEXT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.20-beta-2",
3
+ "version": "2.0.20-beta-3",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"