@threedddplus/logoeditor 0.0.62 → 0.0.64

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.
@@ -2463,6 +2463,37 @@ var fabricSlice = function fabricSlice(set, get) {
2463
2463
  // if(get().count + 1 !== get().storeHistory.length){
2464
2464
  get().fabricCanvas.clear().renderAll();
2465
2465
  get().fabricCanvas.loadFromJSON(get().storeHistory[get().storeHistory.length - 1 - (get().count > 1 ? get().count - 1 : 0)]);
2466
+ // Remove lines
2467
+ get().fabricCanvas.getObjects().forEach(function (obj) {
2468
+ if (obj.type === 'line') {
2469
+ get().fabricCanvas.remove(obj);
2470
+ }
2471
+ });
2472
+ // Add lines
2473
+ var horizontalLine = new fabric.fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2474
+ stroke: "red",
2475
+ scaleX: 11,
2476
+ visible: false,
2477
+ selectable: false,
2478
+ type: 'line'
2479
+ });
2480
+ var verticalLine = new fabric.fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2481
+ stroke: "red",
2482
+ visible: false,
2483
+ selectable: false,
2484
+ type: 'line'
2485
+ });
2486
+ horizontalLine.centerH();
2487
+ get().fabricCanvas.add(horizontalLine);
2488
+ get().fabricCanvas.add(verticalLine);
2489
+ get().fabricCanvas.sendToBack(horizontalLine);
2490
+ get().fabricCanvas.sendToBack(verticalLine);
2491
+ use3dddPlus.setState({
2492
+ horizontalLine: horizontalLine
2493
+ });
2494
+ use3dddPlus.setState({
2495
+ verticalLine: verticalLine
2496
+ });
2466
2497
  get().fabricCanvas.renderAll();
2467
2498
  get().count += 1;
2468
2499
  // }
@@ -2488,6 +2519,37 @@ var fabricSlice = function fabricSlice(set, get) {
2488
2519
  get().fabricCanvas.clear().renderAll();
2489
2520
  var item = Math.abs(get().count - get().storeHistory.length - 2);
2490
2521
  get().fabricCanvas.loadFromJSON(get().storeHistory[item]);
2522
+ // Remove lines
2523
+ get().fabricCanvas.getObjects().forEach(function (obj) {
2524
+ if (obj.type === 'line') {
2525
+ get().fabricCanvas.remove(obj);
2526
+ }
2527
+ });
2528
+ // Add lines
2529
+ var horizontalLine = new fabric.fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2530
+ stroke: "red",
2531
+ scaleX: 11,
2532
+ visible: false,
2533
+ selectable: false,
2534
+ type: 'line'
2535
+ });
2536
+ var verticalLine = new fabric.fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2537
+ stroke: "red",
2538
+ visible: false,
2539
+ selectable: false,
2540
+ type: 'line'
2541
+ });
2542
+ horizontalLine.centerH();
2543
+ get().fabricCanvas.add(horizontalLine);
2544
+ get().fabricCanvas.add(verticalLine);
2545
+ get().fabricCanvas.sendBackwards(horizontalLine);
2546
+ get().fabricCanvas.sendBackwards(verticalLine);
2547
+ use3dddPlus.setState({
2548
+ horizontalLine: horizontalLine
2549
+ });
2550
+ use3dddPlus.setState({
2551
+ verticalLine: verticalLine
2552
+ });
2491
2553
  get().fabricCanvas.renderAll();
2492
2554
  get().count -= 1;
2493
2555
  // Update layers
@@ -2660,6 +2722,8 @@ var fabricSlice = function fabricSlice(set, get) {
2660
2722
  horizontalLine.centerH();
2661
2723
  canvas.add(horizontalLine);
2662
2724
  canvas.add(verticalLine);
2725
+ get().fabricCanvas.sendBackwards(horizontalLine);
2726
+ get().fabricCanvas.sendBackwards(verticalLine);
2663
2727
  use3dddPlus.setState({
2664
2728
  horizontalLine: horizontalLine
2665
2729
  });
@@ -2667,6 +2731,7 @@ var fabricSlice = function fabricSlice(set, get) {
2667
2731
  verticalLine: verticalLine
2668
2732
  });
2669
2733
  canvas.renderAll.bind(canvas);
2734
+ canvas.discardActiveObject();
2670
2735
  use3dddPlus.setState({
2671
2736
  selectedStepper: undefined
2672
2737
  });
@@ -3450,7 +3515,7 @@ var optionpresets = {
3450
3515
  pathomit: 8,
3451
3516
  rightangleenhance: true,
3452
3517
  // Color quantization
3453
- colorsampling: 1,
3518
+ colorsampling: 10,
3454
3519
  numberofcolors: 8,
3455
3520
  mincolorratio: 0,
3456
3521
  colorquantcycles: 3,
@@ -4185,7 +4250,9 @@ var ActionButtons = function ActionButtons() {
4185
4250
  activeSelection = _use3dddPlus[1];
4186
4251
  var selectAllHandler = function selectAllHandler() {
4187
4252
  canvas.discardActiveObject();
4188
- var sel = new fabric.fabric.ActiveSelection(canvas.getObjects(), {
4253
+ var sel = new fabric.fabric.ActiveSelection(canvas.getObjects().filter(function (obj) {
4254
+ return obj.type !== 'line';
4255
+ }), {
4189
4256
  canvas: canvas
4190
4257
  });
4191
4258
  canvas.setActiveObject(sel);
@@ -4219,6 +4286,7 @@ var ActionButtons = function ActionButtons() {
4219
4286
  use3dddPlus.setState({
4220
4287
  selectedAll: false
4221
4288
  });
4289
+ canvas.discardActiveObject();
4222
4290
  // removeItem(activeSelection);
4223
4291
  }
4224
4292
  };
@@ -4541,6 +4609,7 @@ var initCanvas = function initCanvas() {
4541
4609
  getAllColors();
4542
4610
  };
4543
4611
  var onObjectMoving = function onObjectMoving(e) {
4612
+ console.log("logoeditor on moving function", e);
4544
4613
  use3dddPlus.getState().updateModifaction(false);
4545
4614
  var obj = e.target;
4546
4615
  // if (
@@ -4553,10 +4622,12 @@ var initCanvas = function initCanvas() {
4553
4622
  if (obj.getBoundingRect().top < 0 || obj.getBoundingRect().left < 0) {
4554
4623
  obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top);
4555
4624
  obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left);
4625
+ obj.setCoords();
4556
4626
  }
4557
4627
  if (obj.getBoundingRect().top + obj.getBoundingRect().height > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width > obj.canvas.width) {
4558
4628
  obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top);
4559
4629
  obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left);
4630
+ obj.setCoords();
4560
4631
  }
4561
4632
  var brNew = obj.getBoundingRect();
4562
4633
  if (brNew.width + brNew.left >= obj.canvas.width || brNew.height + brNew.top >= obj.canvas.height || brNew.left < 0 || brNew.top < 0) ; else {
@@ -4730,11 +4801,31 @@ var initCanvas = function initCanvas() {
4730
4801
  // use3dddPlus.setState({ selectedAll: false });
4731
4802
  // canvas.discardActiveObject().renderAll();
4732
4803
  // } else {
4733
- canvas.remove(canvasTarget);
4734
- canvas.requestRenderAll();
4735
- removeItem(canvasTarget);
4804
+ // canvas.remove(canvasTarget);
4805
+ // canvas.requestRenderAll();
4806
+ // removeItem(canvasTarget);
4736
4807
  // }
4737
4808
  // use3dddPlus.setState({ defaultColorFill: [] });
4809
+ var activeSelection = use3dddPlus.getState().activeSelection;
4810
+ if (activeSelection) {
4811
+ if (activeSelection.icon) {
4812
+ canvas.remove(activeSelection);
4813
+ removeItem(activeSelection);
4814
+ } else if (activeSelection._objects) {
4815
+ activeSelection._objects.map(function (obj) {
4816
+ canvas.remove(obj);
4817
+ removeItem(obj);
4818
+ });
4819
+ }
4820
+ // canvas.remove(activeSelection);
4821
+ use3dddPlus.getState().updateModifaction(true);
4822
+ canvas.requestRenderAll();
4823
+ use3dddPlus.setState({
4824
+ selectedAll: false
4825
+ });
4826
+ canvas.discardActiveObject();
4827
+ // removeItem(activeSelection);
4828
+ }
4738
4829
  }
4739
4830
 
4740
4831
  var removeItem = function removeItem(value) {
@@ -4909,6 +5000,8 @@ var ContextMenu = function ContextMenu() {
4909
5000
  use3dddPlus.setState({
4910
5001
  showContextMenu: false
4911
5002
  });
5003
+ canvas.sendBackwards(use3dddPlus.getState().verticalLine);
5004
+ canvas.sendBackwards(use3dddPlus.getState().horizontalLine);
4912
5005
  };
4913
5006
  var bringForward = function bringForward() {
4914
5007
  canvas.bringForward(activeObj);
@@ -4949,6 +5042,8 @@ var ContextMenu = function ContextMenu() {
4949
5042
  use3dddPlus.setState({
4950
5043
  showContextMenu: false
4951
5044
  });
5045
+ canvas.sendToBack(use3dddPlus.getState().verticalLine);
5046
+ canvas.sendToBack(use3dddPlus.getState().horizontalLine);
4952
5047
  };
4953
5048
  var bringToFront = function bringToFront() {
4954
5049
  canvas.bringToFront(activeObj);
@@ -6052,12 +6147,12 @@ var PopUpCanvas = function PopUpCanvas() {
6052
6147
  // console.log('MOUSE-CLICK-->',mouseClick);
6053
6148
  // Iterate through objects on the canvas and check if any intersect with the mouse click
6054
6149
  var removedColors = [];
6150
+ use3dddPlus.getState().popUpCanvasUpdateModification(true);
6055
6151
  popupCanv.forEachObject(function (obj) {
6056
6152
  if (obj.type === 'path') {
6057
6153
  //@ts-ignore
6058
6154
  if (obj.containsPoint(mouseClick)) {
6059
6155
  removedColors.push(obj.fill);
6060
- use3dddPlus.getState().popUpCanvasUpdateModification(true);
6061
6156
  popupCanv.remove(obj);
6062
6157
  popupCanv.renderAll();
6063
6158
  }
@@ -6110,6 +6205,9 @@ var PopUpCanvas = function PopUpCanvas() {
6110
6205
  use3dddPlus.setState({
6111
6206
  popupCanvasStoreHistory: []
6112
6207
  });
6208
+ use3dddPlus.setState({
6209
+ popUpCanvasCount: 1
6210
+ });
6113
6211
  };
6114
6212
  var popupCanvasContinue = function popupCanvasContinue() {
6115
6213
  if (!conflictColors || conflictColors.length < 1) {
@@ -8904,11 +9002,10 @@ var Rightmenu = function Rightmenu() {
8904
9002
  className: "uppercase font-bold pt-[17px]"
8905
9003
  }, "Colors"), React__default.createElement("div", {
8906
9004
  className: "flex flex-wrap gap-x-[1rem] mt-[12px]"
8907
- }, activeSelection.colorFill && ((_Object$keys = Object.keys(activeSelection == null ? void 0 : activeSelection.colorFill)) == null ? void 0 : _Object$keys.map(function (item) {
8908
- var _activeSelection$ownM;
9005
+ }, activeSelection.colorFill && ((_Object$keys = Object.keys(activeSelection == null ? void 0 : activeSelection.colorFill)) == null ? void 0 : _Object$keys.map(function (item, i) {
8909
9006
  return React__default.createElement(ColorImpl, {
8910
9007
  mClass: 'mb-[10px]',
8911
- key: activeSelection.colorFill[item] + (activeSelection == null ? void 0 : (_activeSelection$ownM = activeSelection.ownMatrixCache) == null ? void 0 : _activeSelection$ownM.key),
9008
+ key: 'color-' + i,
8912
9009
  handleChange: changeSVGColor,
8913
9010
  property: item,
8914
9011
  color: activeSelection.colorFill[item]
@@ -8946,10 +9043,10 @@ var Rightmenu = function Rightmenu() {
8946
9043
  className: "uppercase font-bold pt-[17px]"
8947
9044
  }, "Color in Canvas"), React__default.createElement("div", {
8948
9045
  className: "flex flex-wrap gap-x-[1rem] mt-[12px] mb-[12px]"
8949
- }, allColor == null ? void 0 : allColor.map(function (item) {
9046
+ }, allColor == null ? void 0 : allColor.map(function (item, i) {
8950
9047
  return React__default.createElement(ColorImpl, {
8951
9048
  mClass: 'mb-[10px]',
8952
- key: item,
9049
+ key: 'color-' + i,
8953
9050
  handleChange: changeSVGTextColor,
8954
9051
  property: item,
8955
9052
  color: item
@@ -8960,10 +9057,10 @@ var Rightmenu = function Rightmenu() {
8960
9057
  className: "uppercase font-bold pt-[17px]"
8961
9058
  }, "Color in Canvas"), React__default.createElement("div", {
8962
9059
  className: "flex flex-wrap gap-x-[1rem] mt-[12px]"
8963
- }, allColor == null ? void 0 : allColor.map(function (item) {
9060
+ }, allColor == null ? void 0 : allColor.map(function (item, i) {
8964
9061
  return React__default.createElement(ColorImpl, {
8965
9062
  mClass: 'mb-[10px]',
8966
- key: item,
9063
+ key: 'color-' + i,
8967
9064
  handleChange: changeSVGTextColor,
8968
9065
  property: item,
8969
9066
  color: item
@@ -9444,7 +9541,7 @@ var SaveDesign = function SaveDesign(_ref) {
9444
9541
  while (1) switch (_context.prev = _context.next) {
9445
9542
  case 0:
9446
9543
  if (isSaving) {
9447
- _context.next = 28;
9544
+ _context.next = 30;
9448
9545
  break;
9449
9546
  }
9450
9547
  if (checkValidations()) {
@@ -9530,6 +9627,8 @@ var SaveDesign = function SaveDesign(_ref) {
9530
9627
  horizontalLine.centerH();
9531
9628
  canvas.add(horizontalLine);
9532
9629
  canvas.add(verticalLine);
9630
+ canvas.sendBackwards(horizontalLine);
9631
+ canvas.sendBackwards(verticalLine);
9533
9632
  use3dddPlus.setState({
9534
9633
  horizontalLine: horizontalLine
9535
9634
  });
@@ -9545,7 +9644,7 @@ var SaveDesign = function SaveDesign(_ref) {
9545
9644
  setIsSaving(false);
9546
9645
  console.log('ERROR in Save Logo:', ex);
9547
9646
  });
9548
- case 28:
9647
+ case 30:
9549
9648
  case "end":
9550
9649
  return _context.stop();
9551
9650
  }