@leapfrog/interactive-canvas 1.3.0 → 1.4.0

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.
@@ -643,6 +643,7 @@ var AbstractCanvasObject = /** @class */ (function () {
643
643
  this.fabricObject = fabricObject;
644
644
  this.data = data ? data : new CanvasObjectData(type, this.fabricObject.id);
645
645
  this.dimensions$ = new BehaviorSubject(new FieldDimensions(this.fabricObject, this.canvas));
646
+ this.opacity$ = new BehaviorSubject(this.fabricObject.opacity);
646
647
  this.updatePinToBottomDistance();
647
648
  this.canvas.getProfile$().subscribe(function (profile) { return _this.onProfileChange(profile); });
648
649
  this.canvas.getLayoutManager$().subscribe(function (layoutManager) { return _this.onLayoutManagerChange(layoutManager); });
@@ -714,6 +715,29 @@ var AbstractCanvasObject = /** @class */ (function () {
714
715
  AbstractCanvasObject.prototype.getDimensions$ = function () {
715
716
  return this.dimensions$;
716
717
  };
718
+ /**
719
+ * @override
720
+ * @inheritDoc
721
+ */
722
+ AbstractCanvasObject.prototype.getOpacity = function () {
723
+ return this.opacity$.value;
724
+ };
725
+ /**
726
+ * @override
727
+ * @inheritDoc
728
+ */
729
+ AbstractCanvasObject.prototype.getOpacity$ = function () {
730
+ return this.opacity$;
731
+ };
732
+ /**
733
+ * @override
734
+ * @inheritDoc
735
+ */
736
+ AbstractCanvasObject.prototype.setOpacity = function (value) {
737
+ this.fabricObject.set({ opacity: value });
738
+ this.opacity$.next(value);
739
+ this.redraw();
740
+ };
717
741
  /**
718
742
  * @override
719
743
  * @inheritDoc
@@ -2783,7 +2807,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
2783
2807
  return __generator(this, function (_a) {
2784
2808
  rectOptions = {
2785
2809
  id: this.randomId(),
2786
- width: 2,
2810
+ width: 1,
2787
2811
  height: 10,
2788
2812
  top: 0,
2789
2813
  left: 0,
@@ -2810,7 +2834,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
2810
2834
  rectOptions = {
2811
2835
  id: this.randomId(),
2812
2836
  width: 10,
2813
- height: 2,
2837
+ height: 1,
2814
2838
  top: 0,
2815
2839
  left: 0,
2816
2840
  fill: "#000000"
@@ -645,6 +645,7 @@ var AbstractCanvasObject = /** @class */ (function () {
645
645
  this.fabricObject = fabricObject;
646
646
  this.data = data ? data : new CanvasObjectData(type, this.fabricObject.id);
647
647
  this.dimensions$ = new rxjs.BehaviorSubject(new FieldDimensions(this.fabricObject, this.canvas));
648
+ this.opacity$ = new rxjs.BehaviorSubject(this.fabricObject.opacity);
648
649
  this.updatePinToBottomDistance();
649
650
  this.canvas.getProfile$().subscribe(function (profile) { return _this.onProfileChange(profile); });
650
651
  this.canvas.getLayoutManager$().subscribe(function (layoutManager) { return _this.onLayoutManagerChange(layoutManager); });
@@ -716,6 +717,29 @@ var AbstractCanvasObject = /** @class */ (function () {
716
717
  AbstractCanvasObject.prototype.getDimensions$ = function () {
717
718
  return this.dimensions$;
718
719
  };
720
+ /**
721
+ * @override
722
+ * @inheritDoc
723
+ */
724
+ AbstractCanvasObject.prototype.getOpacity = function () {
725
+ return this.opacity$.value;
726
+ };
727
+ /**
728
+ * @override
729
+ * @inheritDoc
730
+ */
731
+ AbstractCanvasObject.prototype.getOpacity$ = function () {
732
+ return this.opacity$;
733
+ };
734
+ /**
735
+ * @override
736
+ * @inheritDoc
737
+ */
738
+ AbstractCanvasObject.prototype.setOpacity = function (value) {
739
+ this.fabricObject.set({ opacity: value });
740
+ this.opacity$.next(value);
741
+ this.redraw();
742
+ };
719
743
  /**
720
744
  * @override
721
745
  * @inheritDoc
@@ -2783,7 +2807,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
2783
2807
  return __generator(this, function (_a) {
2784
2808
  rectOptions = {
2785
2809
  id: this.randomId(),
2786
- width: 2,
2810
+ width: 1,
2787
2811
  height: 10,
2788
2812
  top: 0,
2789
2813
  left: 0,
@@ -2810,7 +2834,7 @@ var AbstractInteractiveCanvas = /** @class */ (function () {
2810
2834
  rectOptions = {
2811
2835
  id: this.randomId(),
2812
2836
  width: 10,
2813
- height: 2,
2837
+ height: 1,
2814
2838
  top: 0,
2815
2839
  left: 0,
2816
2840
  fill: "#000000"
@@ -10,6 +10,7 @@ export declare abstract class AbstractCanvasObject<T extends Object> implements
10
10
  protected fabricObject: T;
11
11
  protected data: CanvasObjectData;
12
12
  private readonly dimensions$;
13
+ private readonly opacity$;
13
14
  /**
14
15
  * Create a new instance.
15
16
  * @param type Object type.
@@ -53,6 +54,21 @@ export declare abstract class AbstractCanvasObject<T extends Object> implements
53
54
  * @inheritDoc
54
55
  */
55
56
  getDimensions$(): Observable<IObjectDimensions>;
57
+ /**
58
+ * @override
59
+ * @inheritDoc
60
+ */
61
+ getOpacity(): number;
62
+ /**
63
+ * @override
64
+ * @inheritDoc
65
+ */
66
+ getOpacity$(): Observable<number>;
67
+ /**
68
+ * @override
69
+ * @inheritDoc
70
+ */
71
+ setOpacity(value: number): void;
56
72
  /**
57
73
  * @override
58
74
  * @inheritDoc
@@ -34,6 +34,19 @@ export interface ICanvasObject {
34
34
  * Get an observable for the field dimensions.
35
35
  */
36
36
  getDimensions$(): Observable<IObjectDimensions>;
37
+ /**
38
+ * Get object opacity.
39
+ */
40
+ getOpacity(): number;
41
+ /**
42
+ * Get an observable for the object opacity.
43
+ */
44
+ getOpacity$(): Observable<number>;
45
+ /**
46
+ * Set the object opacity.
47
+ * @param value Opacity.
48
+ */
49
+ setOpacity(value: number): void;
37
50
  /**
38
51
  * Get the component margin.
39
52
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"