@threedddplus/logoeditor 0.0.87 → 0.0.89

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.
@@ -2468,7 +2468,7 @@ var fabricSlice = function fabricSlice(set, get) {
2468
2468
  // clonedObj._objects.map((data) => {
2469
2469
  // get().forStoringAllObject(data);
2470
2470
  // });
2471
- if (clipboard && clipboard._objects && clipboard._objects.length > 0 && clipboard._objects[0]._objects || clipboard._objects && clipboard._objects[0].type === "text") {
2471
+ if (clipboard && clipboard._objects && clipboard._objects.length > 0 && clipboard._objects[0]._objects || clipboard._objects && clipboard._objects[0].type === 'text') {
2472
2472
  clonedObj._objects.map(function (data) {
2473
2473
  data.icon = data.toDataURL('image/png');
2474
2474
  get().forStoringAllObject(data);
@@ -2501,14 +2501,14 @@ var fabricSlice = function fabricSlice(set, get) {
2501
2501
  });
2502
2502
  // Add lines
2503
2503
  var horizontalLine = new fabric.fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2504
- stroke: "red",
2504
+ stroke: 'red',
2505
2505
  scaleX: 11,
2506
2506
  visible: false,
2507
2507
  selectable: false,
2508
2508
  type: 'line'
2509
2509
  });
2510
2510
  var verticalLine = new fabric.fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2511
- stroke: "red",
2511
+ stroke: 'red',
2512
2512
  visible: false,
2513
2513
  selectable: false,
2514
2514
  type: 'line'
@@ -2531,9 +2531,9 @@ var fabricSlice = function fabricSlice(set, get) {
2531
2531
  use3dddPlus.getState().clearLayers();
2532
2532
  var canvasGetobject = get().fabricCanvas.getObjects();
2533
2533
  canvasGetobject.forEach(function (element) {
2534
- if (element.type !== "line") {
2534
+ if (element.type !== 'line') {
2535
2535
  use3dddPlus.getState().forStoringAllObject(element);
2536
- if (element.type === "text") {
2536
+ if (element.type === 'text') {
2537
2537
  get().fabricCanvas.setActiveObject(element);
2538
2538
  use3dddPlus.getState().forIconCapture();
2539
2539
  //@ts-ignore
@@ -2557,14 +2557,14 @@ var fabricSlice = function fabricSlice(set, get) {
2557
2557
  });
2558
2558
  // Add lines
2559
2559
  var horizontalLine = new fabric.fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2560
- stroke: "red",
2560
+ stroke: 'red',
2561
2561
  scaleX: 11,
2562
2562
  visible: false,
2563
2563
  selectable: false,
2564
2564
  type: 'line'
2565
2565
  });
2566
2566
  var verticalLine = new fabric.fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2567
- stroke: "red",
2567
+ stroke: 'red',
2568
2568
  visible: false,
2569
2569
  selectable: false,
2570
2570
  type: 'line'
@@ -2586,9 +2586,9 @@ var fabricSlice = function fabricSlice(set, get) {
2586
2586
  use3dddPlus.getState().clearLayers();
2587
2587
  var canvasGetobject = get().fabricCanvas.getObjects();
2588
2588
  canvasGetobject.forEach(function (element) {
2589
- if (element.type !== "line") {
2589
+ if (element.type !== 'line') {
2590
2590
  use3dddPlus.getState().forStoringAllObject(element);
2591
- if (element.type === "text") {
2591
+ if (element.type === 'text') {
2592
2592
  get().fabricCanvas.setActiveObject(element);
2593
2593
  use3dddPlus.getState().forIconCapture();
2594
2594
  //@ts-ignore
@@ -2769,7 +2769,7 @@ var fabricSlice = function fabricSlice(set, get) {
2769
2769
  use3dddPlus.getState().clearLayers();
2770
2770
  canvas.getObjects().forEach(function (element) {
2771
2771
  element.id = use3dddPlus.getState().guid();
2772
- if (element.type !== "line") {
2772
+ if (element.type !== 'line') {
2773
2773
  use3dddPlus.getState().forStoringAllObject(element);
2774
2774
  }
2775
2775
  canvas.setActiveObject(element);
@@ -2919,7 +2919,16 @@ var fabricSlice = function fabricSlice(set, get) {
2919
2919
  forPopupCanvasColor: {},
2920
2920
  imageData: null,
2921
2921
  horizontalLine: null,
2922
- verticalLine: null
2922
+ verticalLine: null,
2923
+ lastPosition: {
2924
+ top: 0,
2925
+ left: 0
2926
+ },
2927
+ setLastPosition: function setLastPosition(lastPosition) {
2928
+ return set({
2929
+ lastPosition: lastPosition
2930
+ });
2931
+ }
2923
2932
  };
2924
2933
  };
2925
2934
 
@@ -4698,6 +4707,13 @@ var initCanvas = function initCanvas() {
4698
4707
  console.log(e);
4699
4708
  use3dddPlus.getState().updateModifaction(false);
4700
4709
  var obj = e.target;
4710
+ if (isNaN(e.pointer.x) || isNaN(e.pointer.y)) {
4711
+ obj.set({
4712
+ top: use3dddPlus.getState().lastPosition.top,
4713
+ left: use3dddPlus.getState().lastPosition.left
4714
+ });
4715
+ return;
4716
+ }
4701
4717
  // if (
4702
4718
  // obj.getBoundingRect().width > obj.canvas.height ||
4703
4719
  // obj.getBoundingRect().height > obj.canvas.width
@@ -4751,6 +4767,10 @@ var initCanvas = function initCanvas() {
4751
4767
  visible: false
4752
4768
  });
4753
4769
  }
4770
+ use3dddPlus.getState().setLastPosition({
4771
+ top: obj.top,
4772
+ left: obj.left
4773
+ });
4754
4774
  };
4755
4775
  var outerCanvasContainer = document.getElementById('fabCanvas');
4756
4776
  var canv = new fabric.fabric.Canvas('canvas', {