@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.
- package/dist/logoeditor.cjs.development.js +114 -15
- package/dist/logoeditor.cjs.development.js.map +1 -1
- package/dist/logoeditor.cjs.production.min.js +1 -1
- package/dist/logoeditor.cjs.production.min.js.map +1 -1
- package/dist/logoeditor.esm.js +114 -15
- package/dist/logoeditor.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/logoeditor.esm.js
CHANGED
@@ -2455,6 +2455,37 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
2455
2455
|
// if(get().count + 1 !== get().storeHistory.length){
|
2456
2456
|
get().fabricCanvas.clear().renderAll();
|
2457
2457
|
get().fabricCanvas.loadFromJSON(get().storeHistory[get().storeHistory.length - 1 - (get().count > 1 ? get().count - 1 : 0)]);
|
2458
|
+
// Remove lines
|
2459
|
+
get().fabricCanvas.getObjects().forEach(function (obj) {
|
2460
|
+
if (obj.type === 'line') {
|
2461
|
+
get().fabricCanvas.remove(obj);
|
2462
|
+
}
|
2463
|
+
});
|
2464
|
+
// Add lines
|
2465
|
+
var horizontalLine = new fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
|
2466
|
+
stroke: "red",
|
2467
|
+
scaleX: 11,
|
2468
|
+
visible: false,
|
2469
|
+
selectable: false,
|
2470
|
+
type: 'line'
|
2471
|
+
});
|
2472
|
+
var verticalLine = new fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
|
2473
|
+
stroke: "red",
|
2474
|
+
visible: false,
|
2475
|
+
selectable: false,
|
2476
|
+
type: 'line'
|
2477
|
+
});
|
2478
|
+
horizontalLine.centerH();
|
2479
|
+
get().fabricCanvas.add(horizontalLine);
|
2480
|
+
get().fabricCanvas.add(verticalLine);
|
2481
|
+
get().fabricCanvas.sendToBack(horizontalLine);
|
2482
|
+
get().fabricCanvas.sendToBack(verticalLine);
|
2483
|
+
use3dddPlus.setState({
|
2484
|
+
horizontalLine: horizontalLine
|
2485
|
+
});
|
2486
|
+
use3dddPlus.setState({
|
2487
|
+
verticalLine: verticalLine
|
2488
|
+
});
|
2458
2489
|
get().fabricCanvas.renderAll();
|
2459
2490
|
get().count += 1;
|
2460
2491
|
// }
|
@@ -2480,6 +2511,37 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
2480
2511
|
get().fabricCanvas.clear().renderAll();
|
2481
2512
|
var item = Math.abs(get().count - get().storeHistory.length - 2);
|
2482
2513
|
get().fabricCanvas.loadFromJSON(get().storeHistory[item]);
|
2514
|
+
// Remove lines
|
2515
|
+
get().fabricCanvas.getObjects().forEach(function (obj) {
|
2516
|
+
if (obj.type === 'line') {
|
2517
|
+
get().fabricCanvas.remove(obj);
|
2518
|
+
}
|
2519
|
+
});
|
2520
|
+
// Add lines
|
2521
|
+
var horizontalLine = new fabric.Line([0, get().fabricCanvas.height / 2, get().fabricCanvas.height, get().fabricCanvas.height / 2], {
|
2522
|
+
stroke: "red",
|
2523
|
+
scaleX: 11,
|
2524
|
+
visible: false,
|
2525
|
+
selectable: false,
|
2526
|
+
type: 'line'
|
2527
|
+
});
|
2528
|
+
var verticalLine = new fabric.Line([get().fabricCanvas.width / 2, 0, get().fabricCanvas.width / 2, get().fabricCanvas.width], {
|
2529
|
+
stroke: "red",
|
2530
|
+
visible: false,
|
2531
|
+
selectable: false,
|
2532
|
+
type: 'line'
|
2533
|
+
});
|
2534
|
+
horizontalLine.centerH();
|
2535
|
+
get().fabricCanvas.add(horizontalLine);
|
2536
|
+
get().fabricCanvas.add(verticalLine);
|
2537
|
+
get().fabricCanvas.sendBackwards(horizontalLine);
|
2538
|
+
get().fabricCanvas.sendBackwards(verticalLine);
|
2539
|
+
use3dddPlus.setState({
|
2540
|
+
horizontalLine: horizontalLine
|
2541
|
+
});
|
2542
|
+
use3dddPlus.setState({
|
2543
|
+
verticalLine: verticalLine
|
2544
|
+
});
|
2483
2545
|
get().fabricCanvas.renderAll();
|
2484
2546
|
get().count -= 1;
|
2485
2547
|
// Update layers
|
@@ -2652,6 +2714,8 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
2652
2714
|
horizontalLine.centerH();
|
2653
2715
|
canvas.add(horizontalLine);
|
2654
2716
|
canvas.add(verticalLine);
|
2717
|
+
get().fabricCanvas.sendBackwards(horizontalLine);
|
2718
|
+
get().fabricCanvas.sendBackwards(verticalLine);
|
2655
2719
|
use3dddPlus.setState({
|
2656
2720
|
horizontalLine: horizontalLine
|
2657
2721
|
});
|
@@ -2659,6 +2723,7 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
2659
2723
|
verticalLine: verticalLine
|
2660
2724
|
});
|
2661
2725
|
canvas.renderAll.bind(canvas);
|
2726
|
+
canvas.discardActiveObject();
|
2662
2727
|
use3dddPlus.setState({
|
2663
2728
|
selectedStepper: undefined
|
2664
2729
|
});
|
@@ -3442,7 +3507,7 @@ var optionpresets = {
|
|
3442
3507
|
pathomit: 8,
|
3443
3508
|
rightangleenhance: true,
|
3444
3509
|
// Color quantization
|
3445
|
-
colorsampling:
|
3510
|
+
colorsampling: 10,
|
3446
3511
|
numberofcolors: 8,
|
3447
3512
|
mincolorratio: 0,
|
3448
3513
|
colorquantcycles: 3,
|
@@ -4177,7 +4242,9 @@ var ActionButtons = function ActionButtons() {
|
|
4177
4242
|
activeSelection = _use3dddPlus[1];
|
4178
4243
|
var selectAllHandler = function selectAllHandler() {
|
4179
4244
|
canvas.discardActiveObject();
|
4180
|
-
var sel = new fabric.ActiveSelection(canvas.getObjects()
|
4245
|
+
var sel = new fabric.ActiveSelection(canvas.getObjects().filter(function (obj) {
|
4246
|
+
return obj.type !== 'line';
|
4247
|
+
}), {
|
4181
4248
|
canvas: canvas
|
4182
4249
|
});
|
4183
4250
|
canvas.setActiveObject(sel);
|
@@ -4211,6 +4278,7 @@ var ActionButtons = function ActionButtons() {
|
|
4211
4278
|
use3dddPlus.setState({
|
4212
4279
|
selectedAll: false
|
4213
4280
|
});
|
4281
|
+
canvas.discardActiveObject();
|
4214
4282
|
// removeItem(activeSelection);
|
4215
4283
|
}
|
4216
4284
|
};
|
@@ -4533,6 +4601,7 @@ var initCanvas = function initCanvas() {
|
|
4533
4601
|
getAllColors();
|
4534
4602
|
};
|
4535
4603
|
var onObjectMoving = function onObjectMoving(e) {
|
4604
|
+
console.log("logoeditor on moving function", e);
|
4536
4605
|
use3dddPlus.getState().updateModifaction(false);
|
4537
4606
|
var obj = e.target;
|
4538
4607
|
// if (
|
@@ -4545,10 +4614,12 @@ var initCanvas = function initCanvas() {
|
|
4545
4614
|
if (obj.getBoundingRect().top < 0 || obj.getBoundingRect().left < 0) {
|
4546
4615
|
obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top);
|
4547
4616
|
obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left);
|
4617
|
+
obj.setCoords();
|
4548
4618
|
}
|
4549
4619
|
if (obj.getBoundingRect().top + obj.getBoundingRect().height > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width > obj.canvas.width) {
|
4550
4620
|
obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top);
|
4551
4621
|
obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left);
|
4622
|
+
obj.setCoords();
|
4552
4623
|
}
|
4553
4624
|
var brNew = obj.getBoundingRect();
|
4554
4625
|
if (brNew.width + brNew.left >= obj.canvas.width || brNew.height + brNew.top >= obj.canvas.height || brNew.left < 0 || brNew.top < 0) ; else {
|
@@ -4722,11 +4793,31 @@ var initCanvas = function initCanvas() {
|
|
4722
4793
|
// use3dddPlus.setState({ selectedAll: false });
|
4723
4794
|
// canvas.discardActiveObject().renderAll();
|
4724
4795
|
// } else {
|
4725
|
-
canvas.remove(canvasTarget);
|
4726
|
-
canvas.requestRenderAll();
|
4727
|
-
removeItem(canvasTarget);
|
4796
|
+
// canvas.remove(canvasTarget);
|
4797
|
+
// canvas.requestRenderAll();
|
4798
|
+
// removeItem(canvasTarget);
|
4728
4799
|
// }
|
4729
4800
|
// use3dddPlus.setState({ defaultColorFill: [] });
|
4801
|
+
var activeSelection = use3dddPlus.getState().activeSelection;
|
4802
|
+
if (activeSelection) {
|
4803
|
+
if (activeSelection.icon) {
|
4804
|
+
canvas.remove(activeSelection);
|
4805
|
+
removeItem(activeSelection);
|
4806
|
+
} else if (activeSelection._objects) {
|
4807
|
+
activeSelection._objects.map(function (obj) {
|
4808
|
+
canvas.remove(obj);
|
4809
|
+
removeItem(obj);
|
4810
|
+
});
|
4811
|
+
}
|
4812
|
+
// canvas.remove(activeSelection);
|
4813
|
+
use3dddPlus.getState().updateModifaction(true);
|
4814
|
+
canvas.requestRenderAll();
|
4815
|
+
use3dddPlus.setState({
|
4816
|
+
selectedAll: false
|
4817
|
+
});
|
4818
|
+
canvas.discardActiveObject();
|
4819
|
+
// removeItem(activeSelection);
|
4820
|
+
}
|
4730
4821
|
}
|
4731
4822
|
|
4732
4823
|
var removeItem = function removeItem(value) {
|
@@ -4901,6 +4992,8 @@ var ContextMenu = function ContextMenu() {
|
|
4901
4992
|
use3dddPlus.setState({
|
4902
4993
|
showContextMenu: false
|
4903
4994
|
});
|
4995
|
+
canvas.sendBackwards(use3dddPlus.getState().verticalLine);
|
4996
|
+
canvas.sendBackwards(use3dddPlus.getState().horizontalLine);
|
4904
4997
|
};
|
4905
4998
|
var bringForward = function bringForward() {
|
4906
4999
|
canvas.bringForward(activeObj);
|
@@ -4941,6 +5034,8 @@ var ContextMenu = function ContextMenu() {
|
|
4941
5034
|
use3dddPlus.setState({
|
4942
5035
|
showContextMenu: false
|
4943
5036
|
});
|
5037
|
+
canvas.sendToBack(use3dddPlus.getState().verticalLine);
|
5038
|
+
canvas.sendToBack(use3dddPlus.getState().horizontalLine);
|
4944
5039
|
};
|
4945
5040
|
var bringToFront = function bringToFront() {
|
4946
5041
|
canvas.bringToFront(activeObj);
|
@@ -6044,12 +6139,12 @@ var PopUpCanvas = function PopUpCanvas() {
|
|
6044
6139
|
// console.log('MOUSE-CLICK-->',mouseClick);
|
6045
6140
|
// Iterate through objects on the canvas and check if any intersect with the mouse click
|
6046
6141
|
var removedColors = [];
|
6142
|
+
use3dddPlus.getState().popUpCanvasUpdateModification(true);
|
6047
6143
|
popupCanv.forEachObject(function (obj) {
|
6048
6144
|
if (obj.type === 'path') {
|
6049
6145
|
//@ts-ignore
|
6050
6146
|
if (obj.containsPoint(mouseClick)) {
|
6051
6147
|
removedColors.push(obj.fill);
|
6052
|
-
use3dddPlus.getState().popUpCanvasUpdateModification(true);
|
6053
6148
|
popupCanv.remove(obj);
|
6054
6149
|
popupCanv.renderAll();
|
6055
6150
|
}
|
@@ -6102,6 +6197,9 @@ var PopUpCanvas = function PopUpCanvas() {
|
|
6102
6197
|
use3dddPlus.setState({
|
6103
6198
|
popupCanvasStoreHistory: []
|
6104
6199
|
});
|
6200
|
+
use3dddPlus.setState({
|
6201
|
+
popUpCanvasCount: 1
|
6202
|
+
});
|
6105
6203
|
};
|
6106
6204
|
var popupCanvasContinue = function popupCanvasContinue() {
|
6107
6205
|
if (!conflictColors || conflictColors.length < 1) {
|
@@ -8896,11 +8994,10 @@ var Rightmenu = function Rightmenu() {
|
|
8896
8994
|
className: "uppercase font-bold pt-[17px]"
|
8897
8995
|
}, "Colors"), React.createElement("div", {
|
8898
8996
|
className: "flex flex-wrap gap-x-[1rem] mt-[12px]"
|
8899
|
-
}, activeSelection.colorFill && ((_Object$keys = Object.keys(activeSelection == null ? void 0 : activeSelection.colorFill)) == null ? void 0 : _Object$keys.map(function (item) {
|
8900
|
-
var _activeSelection$ownM;
|
8997
|
+
}, activeSelection.colorFill && ((_Object$keys = Object.keys(activeSelection == null ? void 0 : activeSelection.colorFill)) == null ? void 0 : _Object$keys.map(function (item, i) {
|
8901
8998
|
return React.createElement(ColorImpl, {
|
8902
8999
|
mClass: 'mb-[10px]',
|
8903
|
-
key:
|
9000
|
+
key: 'color-' + i,
|
8904
9001
|
handleChange: changeSVGColor,
|
8905
9002
|
property: item,
|
8906
9003
|
color: activeSelection.colorFill[item]
|
@@ -8938,10 +9035,10 @@ var Rightmenu = function Rightmenu() {
|
|
8938
9035
|
className: "uppercase font-bold pt-[17px]"
|
8939
9036
|
}, "Color in Canvas"), React.createElement("div", {
|
8940
9037
|
className: "flex flex-wrap gap-x-[1rem] mt-[12px] mb-[12px]"
|
8941
|
-
}, allColor == null ? void 0 : allColor.map(function (item) {
|
9038
|
+
}, allColor == null ? void 0 : allColor.map(function (item, i) {
|
8942
9039
|
return React.createElement(ColorImpl, {
|
8943
9040
|
mClass: 'mb-[10px]',
|
8944
|
-
key:
|
9041
|
+
key: 'color-' + i,
|
8945
9042
|
handleChange: changeSVGTextColor,
|
8946
9043
|
property: item,
|
8947
9044
|
color: item
|
@@ -8952,10 +9049,10 @@ var Rightmenu = function Rightmenu() {
|
|
8952
9049
|
className: "uppercase font-bold pt-[17px]"
|
8953
9050
|
}, "Color in Canvas"), React.createElement("div", {
|
8954
9051
|
className: "flex flex-wrap gap-x-[1rem] mt-[12px]"
|
8955
|
-
}, allColor == null ? void 0 : allColor.map(function (item) {
|
9052
|
+
}, allColor == null ? void 0 : allColor.map(function (item, i) {
|
8956
9053
|
return React.createElement(ColorImpl, {
|
8957
9054
|
mClass: 'mb-[10px]',
|
8958
|
-
key:
|
9055
|
+
key: 'color-' + i,
|
8959
9056
|
handleChange: changeSVGTextColor,
|
8960
9057
|
property: item,
|
8961
9058
|
color: item
|
@@ -9436,7 +9533,7 @@ var SaveDesign = function SaveDesign(_ref) {
|
|
9436
9533
|
while (1) switch (_context.prev = _context.next) {
|
9437
9534
|
case 0:
|
9438
9535
|
if (isSaving) {
|
9439
|
-
_context.next =
|
9536
|
+
_context.next = 30;
|
9440
9537
|
break;
|
9441
9538
|
}
|
9442
9539
|
if (checkValidations()) {
|
@@ -9522,6 +9619,8 @@ var SaveDesign = function SaveDesign(_ref) {
|
|
9522
9619
|
horizontalLine.centerH();
|
9523
9620
|
canvas.add(horizontalLine);
|
9524
9621
|
canvas.add(verticalLine);
|
9622
|
+
canvas.sendBackwards(horizontalLine);
|
9623
|
+
canvas.sendBackwards(verticalLine);
|
9525
9624
|
use3dddPlus.setState({
|
9526
9625
|
horizontalLine: horizontalLine
|
9527
9626
|
});
|
@@ -9537,7 +9636,7 @@ var SaveDesign = function SaveDesign(_ref) {
|
|
9537
9636
|
setIsSaving(false);
|
9538
9637
|
console.log('ERROR in Save Logo:', ex);
|
9539
9638
|
});
|
9540
|
-
case
|
9639
|
+
case 30:
|
9541
9640
|
case "end":
|
9542
9641
|
return _context.stop();
|
9543
9642
|
}
|