@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.
@@ -2460,7 +2460,7 @@ var fabricSlice = function fabricSlice(set, get) {
2460
2460
  // clonedObj._objects.map((data) => {
2461
2461
  // get().forStoringAllObject(data);
2462
2462
  // });
2463
- if (clipboard && clipboard._objects && clipboard._objects.length > 0 && clipboard._objects[0]._objects || clipboard._objects && clipboard._objects[0].type === "text") {
2463
+ if (clipboard && clipboard._objects && clipboard._objects.length > 0 && clipboard._objects[0]._objects || clipboard._objects && clipboard._objects[0].type === 'text') {
2464
2464
  clonedObj._objects.map(function (data) {
2465
2465
  data.icon = data.toDataURL('image/png');
2466
2466
  get().forStoringAllObject(data);
@@ -2493,14 +2493,14 @@ var fabricSlice = function fabricSlice(set, get) {
2493
2493
  });
2494
2494
  // Add lines
2495
2495
  var horizontalLine = new fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2496
- stroke: "red",
2496
+ stroke: 'red',
2497
2497
  scaleX: 11,
2498
2498
  visible: false,
2499
2499
  selectable: false,
2500
2500
  type: 'line'
2501
2501
  });
2502
2502
  var verticalLine = new fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2503
- stroke: "red",
2503
+ stroke: 'red',
2504
2504
  visible: false,
2505
2505
  selectable: false,
2506
2506
  type: 'line'
@@ -2523,9 +2523,9 @@ var fabricSlice = function fabricSlice(set, get) {
2523
2523
  use3dddPlus.getState().clearLayers();
2524
2524
  var canvasGetobject = get().fabricCanvas.getObjects();
2525
2525
  canvasGetobject.forEach(function (element) {
2526
- if (element.type !== "line") {
2526
+ if (element.type !== 'line') {
2527
2527
  use3dddPlus.getState().forStoringAllObject(element);
2528
- if (element.type === "text") {
2528
+ if (element.type === 'text') {
2529
2529
  get().fabricCanvas.setActiveObject(element);
2530
2530
  use3dddPlus.getState().forIconCapture();
2531
2531
  //@ts-ignore
@@ -2549,14 +2549,14 @@ var fabricSlice = function fabricSlice(set, get) {
2549
2549
  });
2550
2550
  // Add lines
2551
2551
  var horizontalLine = new fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
2552
- stroke: "red",
2552
+ stroke: 'red',
2553
2553
  scaleX: 11,
2554
2554
  visible: false,
2555
2555
  selectable: false,
2556
2556
  type: 'line'
2557
2557
  });
2558
2558
  var verticalLine = new fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
2559
- stroke: "red",
2559
+ stroke: 'red',
2560
2560
  visible: false,
2561
2561
  selectable: false,
2562
2562
  type: 'line'
@@ -2578,9 +2578,9 @@ var fabricSlice = function fabricSlice(set, get) {
2578
2578
  use3dddPlus.getState().clearLayers();
2579
2579
  var canvasGetobject = get().fabricCanvas.getObjects();
2580
2580
  canvasGetobject.forEach(function (element) {
2581
- if (element.type !== "line") {
2581
+ if (element.type !== 'line') {
2582
2582
  use3dddPlus.getState().forStoringAllObject(element);
2583
- if (element.type === "text") {
2583
+ if (element.type === 'text') {
2584
2584
  get().fabricCanvas.setActiveObject(element);
2585
2585
  use3dddPlus.getState().forIconCapture();
2586
2586
  //@ts-ignore
@@ -2761,7 +2761,7 @@ var fabricSlice = function fabricSlice(set, get) {
2761
2761
  use3dddPlus.getState().clearLayers();
2762
2762
  canvas.getObjects().forEach(function (element) {
2763
2763
  element.id = use3dddPlus.getState().guid();
2764
- if (element.type !== "line") {
2764
+ if (element.type !== 'line') {
2765
2765
  use3dddPlus.getState().forStoringAllObject(element);
2766
2766
  }
2767
2767
  canvas.setActiveObject(element);
@@ -2911,7 +2911,16 @@ var fabricSlice = function fabricSlice(set, get) {
2911
2911
  forPopupCanvasColor: {},
2912
2912
  imageData: null,
2913
2913
  horizontalLine: null,
2914
- verticalLine: null
2914
+ verticalLine: null,
2915
+ lastPosition: {
2916
+ top: 0,
2917
+ left: 0
2918
+ },
2919
+ setLastPosition: function setLastPosition(lastPosition) {
2920
+ return set({
2921
+ lastPosition: lastPosition
2922
+ });
2923
+ }
2915
2924
  };
2916
2925
  };
2917
2926
 
@@ -4690,6 +4699,13 @@ var initCanvas = function initCanvas() {
4690
4699
  console.log(e);
4691
4700
  use3dddPlus.getState().updateModifaction(false);
4692
4701
  var obj = e.target;
4702
+ if (isNaN(e.pointer.x) || isNaN(e.pointer.y)) {
4703
+ obj.set({
4704
+ top: use3dddPlus.getState().lastPosition.top,
4705
+ left: use3dddPlus.getState().lastPosition.left
4706
+ });
4707
+ return;
4708
+ }
4693
4709
  // if (
4694
4710
  // obj.getBoundingRect().width > obj.canvas.height ||
4695
4711
  // obj.getBoundingRect().height > obj.canvas.width
@@ -4743,6 +4759,10 @@ var initCanvas = function initCanvas() {
4743
4759
  visible: false
4744
4760
  });
4745
4761
  }
4762
+ use3dddPlus.getState().setLastPosition({
4763
+ top: obj.top,
4764
+ left: obj.left
4765
+ });
4746
4766
  };
4747
4767
  var outerCanvasContainer = document.getElementById('fabCanvas');
4748
4768
  var canv = new fabric.Canvas('canvas', {