@leapfrog/interactive-canvas 1.14.2 → 1.14.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.
- package/dist/abstract-interactive-canvas.d.ts +4 -0
- package/dist/interactive-canvas.es.js +17 -4
- package/dist/interactive-canvas.js +17 -4
- package/dist/object/impl/extended-fabric-object.interface.d.ts +7 -0
- package/dist/object/impl/extended-fabric-textbox.interface.d.ts +2 -1
- package/package.json +1 -1
|
@@ -280,6 +280,10 @@ export declare abstract class AbstractInteractiveCanvas implements IInteractiveC
|
|
|
280
280
|
* deletes all circles on canvas load.
|
|
281
281
|
*/
|
|
282
282
|
private removePersistedBullets;
|
|
283
|
+
/**
|
|
284
|
+
* Remove any slave objects persisted to the canvas; their master objects will recreate them.
|
|
285
|
+
*/
|
|
286
|
+
private removeSlaveObjects;
|
|
283
287
|
/**
|
|
284
288
|
* @override
|
|
285
289
|
* @inheritDoc
|
|
@@ -2483,7 +2483,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
else {
|
|
2485
2485
|
// Create new marker for this line
|
|
2486
|
-
|
|
2486
|
+
var textbox = new fabric.Textbox(lineIndex + ".", {
|
|
2487
2487
|
left: 0,
|
|
2488
2488
|
top: 0,
|
|
2489
2489
|
fill: fabricText.fill,
|
|
@@ -2493,9 +2493,10 @@ var Text = /** @class */ (function (_super) {
|
|
|
2493
2493
|
lockMovementX: true,
|
|
2494
2494
|
lockMovementY: true,
|
|
2495
2495
|
hasControls: false,
|
|
2496
|
-
selectable: false
|
|
2497
|
-
excludeFromExport: true
|
|
2496
|
+
selectable: false
|
|
2498
2497
|
});
|
|
2498
|
+
textbox._isSlaveObject = true;
|
|
2499
|
+
activeMarkers_1[lineIndex] = textbox;
|
|
2499
2500
|
}
|
|
2500
2501
|
}
|
|
2501
2502
|
}
|
|
@@ -3483,7 +3484,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3483
3484
|
var objects = _(this.objects$.value)
|
|
3484
3485
|
.map(function (x) { return x.persist(); })
|
|
3485
3486
|
.value();
|
|
3486
|
-
var includedProperties = ["id", "_isOrderedList", "_orderedListStart"];
|
|
3487
|
+
var includedProperties = ["id", "_isSlaveObject", "_isOrderedList", "_orderedListStart"];
|
|
3487
3488
|
var json = this.fabricCanvas.toJSON(includedProperties);
|
|
3488
3489
|
return {
|
|
3489
3490
|
dimensions: this.dimensions$.value,
|
|
@@ -3518,6 +3519,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3518
3519
|
this.backgroundColor$.next(this.fabricCanvas.backgroundColor);
|
|
3519
3520
|
this.bindFields(canvasState.objects);
|
|
3520
3521
|
this.removePersistedBullets();
|
|
3522
|
+
this.removeSlaveObjects();
|
|
3521
3523
|
this.layoutManager$.value.onInit();
|
|
3522
3524
|
return [2 /*return*/];
|
|
3523
3525
|
}
|
|
@@ -3537,6 +3539,17 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3537
3539
|
_this.removeFabricObject(object);
|
|
3538
3540
|
});
|
|
3539
3541
|
};
|
|
3542
|
+
/**
|
|
3543
|
+
* Remove any slave objects persisted to the canvas; their master objects will recreate them.
|
|
3544
|
+
*/
|
|
3545
|
+
AbstractInteractiveCanvas.prototype.removeSlaveObjects = function () {
|
|
3546
|
+
var _this = this;
|
|
3547
|
+
var objects = this.fabricCanvas.getObjects();
|
|
3548
|
+
each(objects, function (object) {
|
|
3549
|
+
if (object._isSlaveObject)
|
|
3550
|
+
_this.removeFabricObject(object);
|
|
3551
|
+
});
|
|
3552
|
+
};
|
|
3540
3553
|
/**
|
|
3541
3554
|
* @override
|
|
3542
3555
|
* @inheritDoc
|
|
@@ -2485,7 +2485,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
2485
2485
|
}
|
|
2486
2486
|
else {
|
|
2487
2487
|
// Create new marker for this line
|
|
2488
|
-
|
|
2488
|
+
var textbox = new fabric.Textbox(lineIndex + ".", {
|
|
2489
2489
|
left: 0,
|
|
2490
2490
|
top: 0,
|
|
2491
2491
|
fill: fabricText.fill,
|
|
@@ -2495,9 +2495,10 @@ var Text = /** @class */ (function (_super) {
|
|
|
2495
2495
|
lockMovementX: true,
|
|
2496
2496
|
lockMovementY: true,
|
|
2497
2497
|
hasControls: false,
|
|
2498
|
-
selectable: false
|
|
2499
|
-
excludeFromExport: true
|
|
2498
|
+
selectable: false
|
|
2500
2499
|
});
|
|
2500
|
+
textbox._isSlaveObject = true;
|
|
2501
|
+
activeMarkers_1[lineIndex] = textbox;
|
|
2501
2502
|
}
|
|
2502
2503
|
}
|
|
2503
2504
|
}
|
|
@@ -3483,7 +3484,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3483
3484
|
var objects = _(this.objects$.value)
|
|
3484
3485
|
.map(function (x) { return x.persist(); })
|
|
3485
3486
|
.value();
|
|
3486
|
-
var includedProperties = ["id", "_isOrderedList", "_orderedListStart"];
|
|
3487
|
+
var includedProperties = ["id", "_isSlaveObject", "_isOrderedList", "_orderedListStart"];
|
|
3487
3488
|
var json = this.fabricCanvas.toJSON(includedProperties);
|
|
3488
3489
|
return {
|
|
3489
3490
|
dimensions: this.dimensions$.value,
|
|
@@ -3518,6 +3519,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3518
3519
|
this.backgroundColor$.next(this.fabricCanvas.backgroundColor);
|
|
3519
3520
|
this.bindFields(canvasState.objects);
|
|
3520
3521
|
this.removePersistedBullets();
|
|
3522
|
+
this.removeSlaveObjects();
|
|
3521
3523
|
this.layoutManager$.value.onInit();
|
|
3522
3524
|
return [2 /*return*/];
|
|
3523
3525
|
}
|
|
@@ -3537,6 +3539,17 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
|
|
|
3537
3539
|
_this.removeFabricObject(object);
|
|
3538
3540
|
});
|
|
3539
3541
|
};
|
|
3542
|
+
/**
|
|
3543
|
+
* Remove any slave objects persisted to the canvas; their master objects will recreate them.
|
|
3544
|
+
*/
|
|
3545
|
+
AbstractInteractiveCanvas.prototype.removeSlaveObjects = function () {
|
|
3546
|
+
var _this = this;
|
|
3547
|
+
var objects = this.fabricCanvas.getObjects();
|
|
3548
|
+
_.each(objects, function (object) {
|
|
3549
|
+
if (object._isSlaveObject)
|
|
3550
|
+
_this.removeFabricObject(object);
|
|
3551
|
+
});
|
|
3552
|
+
};
|
|
3540
3553
|
/**
|
|
3541
3554
|
* @override
|
|
3542
3555
|
* @inheritDoc
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fabric } from "fabric";
|
|
2
|
+
export interface ExtendedFabricObject extends fabric.Object {
|
|
3
|
+
/**
|
|
4
|
+
* If true, this object is a slave object controlled by another object and not directly by the user, such as the line markers in an ordered list.
|
|
5
|
+
*/
|
|
6
|
+
_isSlaveObject?: boolean;
|
|
7
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fabric } from "fabric";
|
|
2
|
-
|
|
2
|
+
import { ExtendedFabricObject } from "./extended-fabric-object.interface";
|
|
3
|
+
export interface ExtendedFabricTextbox extends fabric.Textbox, ExtendedFabricObject {
|
|
3
4
|
_isOrderedList?: boolean;
|
|
4
5
|
_orderedListStart?: number;
|
|
5
6
|
_orderedListMarkerEntities?: fabric.Textbox[];
|