@leapfrog/interactive-canvas 2.0.20 → 2.0.21-beta-1

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.
@@ -1,4 +1,4 @@
1
- import _, { round, each, values, reduce, clone, isEqual } from 'lodash';
1
+ import _, { round, each, values, reduce, clone, max, isEqual } from 'lodash';
2
2
  import { BehaviorSubject, Subject } from 'rxjs';
3
3
  import * as fabric from 'fabric';
4
4
 
@@ -2028,11 +2028,12 @@ class Text extends AbstractCanvasObject {
2028
2028
  */
2029
2029
  setFontSize(fontSize) {
2030
2030
  if (this.hasTextSelection()) {
2031
- this.fabricObject.setSelectionStyles({ fontSize });
2031
+ this.fabricObject.setSelectionStyles({ fontSize: fontSize });
2032
2032
  }
2033
2033
  else {
2034
2034
  this.fabricObject.set({ fontSize: fontSize });
2035
2035
  }
2036
+ this.fabricObject.dirty = true;
2036
2037
  this.redraw();
2037
2038
  this.updateTextSelection();
2038
2039
  }
@@ -2130,7 +2131,7 @@ class Text extends AbstractCanvasObject {
2130
2131
  if (!this.isBulleted())
2131
2132
  return 0;
2132
2133
  let fontSize = 0;
2133
- _.each(this.fabricObject._textLines, (textLine, lineIndex) => {
2134
+ each(this.fabricObject._textLines, (textLine, lineIndex) => {
2134
2135
  fontSize = Math.max(fontSize, this.fabricObject.getValueOfPropertyAt(lineIndex, 0, "fontSize"));
2135
2136
  });
2136
2137
  return fontSize * 0.6;
@@ -2143,11 +2144,10 @@ class Text extends AbstractCanvasObject {
2143
2144
  if (!this.isOrderedList())
2144
2145
  return 0;
2145
2146
  const orderedListMarkerEntities = this.fabricObject._orderedListMarkerEntities;
2146
- let max = _(orderedListMarkerEntities)
2147
+ let maxValue = max((orderedListMarkerEntities !== null && orderedListMarkerEntities !== void 0 ? orderedListMarkerEntities : [])
2147
2148
  .filter((x) => !!x)
2148
- .map((x) => x.getBoundingRect().width)
2149
- .max();
2150
- return max ? (max * 1.2) : 0;
2149
+ .map((x) => x.getBoundingRect().width));
2150
+ return maxValue ? (maxValue * 1.2) : 0;
2151
2151
  }
2152
2152
  /**
2153
2153
  * @override
@@ -2281,7 +2281,7 @@ class Text extends AbstractCanvasObject {
2281
2281
  if (this.data.bulleted) {
2282
2282
  const bullets = this.fabricObject["_bullets"];
2283
2283
  delete this.fabricObject["_bullets"];
2284
- _.each(bullets, (bullet) => this.canvas.removeFabricObject(bullet));
2284
+ each(bullets, (bullet) => this.canvas.removeFabricObject(bullet));
2285
2285
  this.fabricObject["objectCaching"] = true;
2286
2286
  }
2287
2287
  }
@@ -2289,7 +2289,7 @@ class Text extends AbstractCanvasObject {
2289
2289
  if (this.fabricObject._isOrderedList) {
2290
2290
  const markerEntities = this.fabricObject._orderedListMarkerEntities;
2291
2291
  delete this.fabricObject._orderedListMarkerEntities;
2292
- _.each(markerEntities, (marker) => this.canvas.removeFabricObject(marker));
2292
+ each(markerEntities, (marker) => this.canvas.removeFabricObject(marker));
2293
2293
  this.fabricObject["objectCaching"] = true;
2294
2294
  }
2295
2295
  }
@@ -2306,7 +2306,7 @@ class Text extends AbstractCanvasObject {
2306
2306
  // Determine list of active bullets
2307
2307
  const currentBullets = this.fabricObject.get("_bullets");
2308
2308
  const activeBullets = {};
2309
- _.each(this.fabricObject._textLines, (textLine, lineIndex) => {
2309
+ each(this.fabricObject._textLines, (textLine, lineIndex) => {
2310
2310
  if (textLine.length) {
2311
2311
  // Start of real lines will have offset 0 in styleMap
2312
2312
  const styleMap = this.fabricObject._styleMap[lineIndex];
@@ -2343,13 +2343,13 @@ class Text extends AbstractCanvasObject {
2343
2343
  let canvasDirty = false;
2344
2344
  if (canvas) {
2345
2345
  canvas.renderOnAddRemove = false;
2346
- _.each(activeBullets, (bullet) => {
2346
+ each(activeBullets, (bullet) => {
2347
2347
  if (!canvas.contains(bullet)) {
2348
2348
  canvas.add(bullet);
2349
2349
  canvasDirty = true;
2350
2350
  }
2351
2351
  });
2352
- _.each(currentBullets, (bullet, key) => {
2352
+ each(currentBullets, (bullet, key) => {
2353
2353
  if (!activeBullets[key]) {
2354
2354
  canvas.remove(bullet);
2355
2355
  canvasDirty = true;
@@ -2366,7 +2366,7 @@ class Text extends AbstractCanvasObject {
2366
2366
  if (this.fabricObject._isOrderedList) {
2367
2367
  const existingMarkers = (_a = this.fabricObject._orderedListMarkerEntities) !== null && _a !== void 0 ? _a : [];
2368
2368
  const activeMarkers = [];
2369
- _.each(this.fabricObject._textLines, (textLine, lineIndex) => {
2369
+ each(this.fabricObject._textLines, (textLine, lineIndex) => {
2370
2370
  if (textLine.length) {
2371
2371
  // Start of real lines will have offset 0 in styleMap
2372
2372
  const styleMap = this.fabricObject._styleMap[lineIndex];
@@ -2402,7 +2402,7 @@ class Text extends AbstractCanvasObject {
2402
2402
  let canvasDirty = false;
2403
2403
  if (canvas) {
2404
2404
  canvas.renderOnAddRemove = false;
2405
- _.each(activeMarkers, (marker) => {
2405
+ each(activeMarkers, (marker) => {
2406
2406
  if (!marker)
2407
2407
  return;
2408
2408
  if (!canvas.contains(marker)) {
@@ -2410,7 +2410,7 @@ class Text extends AbstractCanvasObject {
2410
2410
  canvasDirty = true;
2411
2411
  }
2412
2412
  });
2413
- _.each(existingMarkers, (marker, key) => {
2413
+ each(existingMarkers, (marker, key) => {
2414
2414
  if (!marker)
2415
2415
  return;
2416
2416
  if (!activeMarkers[key]) {
@@ -2049,11 +2049,12 @@ class Text extends AbstractCanvasObject {
2049
2049
  */
2050
2050
  setFontSize(fontSize) {
2051
2051
  if (this.hasTextSelection()) {
2052
- this.fabricObject.setSelectionStyles({ fontSize });
2052
+ this.fabricObject.setSelectionStyles({ fontSize: fontSize });
2053
2053
  }
2054
2054
  else {
2055
2055
  this.fabricObject.set({ fontSize: fontSize });
2056
2056
  }
2057
+ this.fabricObject.dirty = true;
2057
2058
  this.redraw();
2058
2059
  this.updateTextSelection();
2059
2060
  }
@@ -2164,11 +2165,10 @@ class Text extends AbstractCanvasObject {
2164
2165
  if (!this.isOrderedList())
2165
2166
  return 0;
2166
2167
  const orderedListMarkerEntities = this.fabricObject._orderedListMarkerEntities;
2167
- let max = _(orderedListMarkerEntities)
2168
+ let maxValue = _.max((orderedListMarkerEntities !== null && orderedListMarkerEntities !== void 0 ? orderedListMarkerEntities : [])
2168
2169
  .filter((x) => !!x)
2169
- .map((x) => x.getBoundingRect().width)
2170
- .max();
2171
- return max ? (max * 1.2) : 0;
2170
+ .map((x) => x.getBoundingRect().width));
2171
+ return maxValue ? (maxValue * 1.2) : 0;
2172
2172
  }
2173
2173
  /**
2174
2174
  * @override
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.20",
3
+ "version": "2.0.21-beta-1",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"