@threedddplus/logoeditor 0.0.65 → 0.0.67
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/data.d.ts +44 -0
- package/dist/logoeditor.cjs.development.js +157 -24
- 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 +157 -24
- package/dist/logoeditor.esm.js.map +1 -1
- package/dist/store/converters/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/logoeditor.esm.js
CHANGED
@@ -2412,15 +2412,45 @@ var fabricSlice = function fabricSlice(set, get) {
|
|
2412
2412
|
clonedObj.canvas = get().fabricCanvas;
|
2413
2413
|
clonedObj.forEachObject(function (obj, index) {
|
2414
2414
|
obj.colorFill = activeObj._objects[index].colorFill;
|
2415
|
+
// copy all path text data & clone text props as well(text with shapes applied)
|
2416
|
+
if (activeObj.type === 'path' && activeObj.pathData !== undefined) {
|
2417
|
+
obj.pathData = activeObj.pathData;
|
2418
|
+
obj.shapeSize = activeObj.shapeSize;
|
2419
|
+
obj.shapeType = activeObj.shapeType;
|
2420
|
+
obj.fontFamily = activeObj.fontFamily;
|
2421
|
+
obj.fontWeight = activeObj.fontWeight;
|
2422
|
+
obj.fontSize = activeObj.fontSize;
|
2423
|
+
obj.charSpacing = activeObj.charSpacing;
|
2424
|
+
obj.textAlign = activeObj.textAlign;
|
2425
|
+
obj.fontStyle = activeObj.fontStyle;
|
2426
|
+
obj.text = activeObj.text;
|
2427
|
+
}
|
2415
2428
|
get().fabricCanvas.add(obj);
|
2416
2429
|
});
|
2417
2430
|
clonedObj.setCoords();
|
2418
2431
|
} else {
|
2419
2432
|
clonedObj.colorFill = activeObj.colorFill;
|
2433
|
+
// copy all path text data & clone text props as well(text with shapes applied)
|
2434
|
+
if (activeObj.type === 'path' && activeObj.pathData !== undefined) {
|
2435
|
+
clonedObj.pathData = activeObj.pathData;
|
2436
|
+
clonedObj.shapeSize = activeObj.shapeSize;
|
2437
|
+
clonedObj.shapeType = activeObj.shapeType;
|
2438
|
+
clonedObj.fontFamily = activeObj.fontFamily;
|
2439
|
+
clonedObj.fontWeight = activeObj.fontWeight;
|
2440
|
+
clonedObj.fontSize = activeObj.fontSize;
|
2441
|
+
clonedObj.charSpacing = activeObj.charSpacing;
|
2442
|
+
clonedObj.textAlign = activeObj.textAlign;
|
2443
|
+
clonedObj.fontStyle = activeObj.fontStyle;
|
2444
|
+
clonedObj.text = activeObj.text;
|
2445
|
+
}
|
2420
2446
|
get().fabricCanvas.add(clonedObj);
|
2421
2447
|
}
|
2422
2448
|
clipboard.top += 20;
|
2423
2449
|
clipboard.left += 20;
|
2450
|
+
if (activeObj && activeObj.shapeType && activeObj.shapeType.length > 0) {
|
2451
|
+
clonedObj.shapeType = activeObj.shapeType;
|
2452
|
+
clonedObj.shapeSize = activeObj.shapeSize;
|
2453
|
+
}
|
2424
2454
|
get().fabricCanvas.setActiveObject(clonedObj);
|
2425
2455
|
clonedObj.set({
|
2426
2456
|
left: clonedObj.left + 20,
|
@@ -3507,7 +3537,7 @@ var optionpresets = {
|
|
3507
3537
|
pathomit: 8,
|
3508
3538
|
rightangleenhance: true,
|
3509
3539
|
// Color quantization
|
3510
|
-
colorsampling:
|
3540
|
+
colorsampling: 1,
|
3511
3541
|
numberofcolors: 8,
|
3512
3542
|
mincolorratio: 0,
|
3513
3543
|
colorquantcycles: 3,
|
@@ -3526,6 +3556,62 @@ var optionpresets = {
|
|
3526
3556
|
blurradius: 0,
|
3527
3557
|
blurdelta: 20
|
3528
3558
|
},
|
3559
|
+
'png': {
|
3560
|
+
// Tracing
|
3561
|
+
corsenabled: true,
|
3562
|
+
ltres: 0.08,
|
3563
|
+
qtres: 0.1,
|
3564
|
+
pathomit: 8,
|
3565
|
+
rightangleenhance: true,
|
3566
|
+
// Color quantization
|
3567
|
+
colorsampling: 10,
|
3568
|
+
numberofcolors: 8,
|
3569
|
+
mincolorratio: 0,
|
3570
|
+
colorquantcycles: 3,
|
3571
|
+
// Layering method
|
3572
|
+
layering: 0,
|
3573
|
+
// SVG rendering
|
3574
|
+
strokewidth: 1,
|
3575
|
+
linefilter: false,
|
3576
|
+
scale: 1,
|
3577
|
+
roundcoords: 1,
|
3578
|
+
viewbox: false,
|
3579
|
+
desc: false,
|
3580
|
+
lcpr: 0,
|
3581
|
+
qcpr: 0,
|
3582
|
+
// Blur
|
3583
|
+
blurradius: 0,
|
3584
|
+
blurdelta: 20 //20
|
3585
|
+
},
|
3586
|
+
|
3587
|
+
'jpg': {
|
3588
|
+
// Tracing
|
3589
|
+
corsenabled: true,
|
3590
|
+
ltres: 0.9,
|
3591
|
+
qtres: 0.9,
|
3592
|
+
pathomit: 16,
|
3593
|
+
rightangleenhance: true,
|
3594
|
+
// Color quantization
|
3595
|
+
colorsampling: 5,
|
3596
|
+
numberofcolors: 8,
|
3597
|
+
mincolorratio: 0,
|
3598
|
+
colorquantcycles: 10,
|
3599
|
+
// Layering method
|
3600
|
+
layering: 0,
|
3601
|
+
// SVG rendering
|
3602
|
+
strokewidth: 1,
|
3603
|
+
linefilter: false,
|
3604
|
+
scale: 1,
|
3605
|
+
roundcoords: 1,
|
3606
|
+
viewbox: false,
|
3607
|
+
desc: false,
|
3608
|
+
lcpr: 0,
|
3609
|
+
qcpr: 0,
|
3610
|
+
// Blur
|
3611
|
+
blurradius: 0.5,
|
3612
|
+
blurdelta: 10 //20
|
3613
|
+
},
|
3614
|
+
|
3529
3615
|
'posterized1': {
|
3530
3616
|
colorsampling: 0,
|
3531
3617
|
numberofcolors: 2
|
@@ -3880,7 +3966,7 @@ var converterSlice = function converterSlice(set, get) {
|
|
3880
3966
|
}
|
3881
3967
|
return loadImageFromURL;
|
3882
3968
|
}(),
|
3883
|
-
imageToSVG: function imageToSVG(data, isSVG, convert) {
|
3969
|
+
imageToSVG: function imageToSVG(data, ext, isSVG, convert) {
|
3884
3970
|
if (isSVG === void 0) {
|
3885
3971
|
isSVG = false;
|
3886
3972
|
}
|
@@ -3909,7 +3995,7 @@ var converterSlice = function converterSlice(set, get) {
|
|
3909
3995
|
imageData: svgstr
|
3910
3996
|
});
|
3911
3997
|
processImage(svgstr, 8);
|
3912
|
-
}, optionpresets["default"]);
|
3998
|
+
}, ext && (ext.toLowerCase() === "jpg" || ext.toLowerCase() === "jpeg") ? optionpresets.jpg : ext.toLowerCase() === "png" ? optionpresets.png : optionpresets["default"]);
|
3913
3999
|
}
|
3914
4000
|
} else {
|
3915
4001
|
processImage(data, 8);
|
@@ -4692,14 +4778,14 @@ var initCanvas = function initCanvas() {
|
|
4692
4778
|
return Math.abs(scaledObjCenterX - canvasCenterX) < threshold;
|
4693
4779
|
}
|
4694
4780
|
var horizontalLine = new fabric.Line([0, canv.height / 2, canv.height, canv.height / 2], {
|
4695
|
-
stroke:
|
4781
|
+
stroke: "red",
|
4696
4782
|
scaleX: 11,
|
4697
4783
|
visible: false,
|
4698
4784
|
selectable: false,
|
4699
4785
|
type: 'line'
|
4700
4786
|
});
|
4701
4787
|
var verticalLine = new fabric.Line([canv.width / 2, 0, canv.width / 2, canv.width], {
|
4702
|
-
stroke:
|
4788
|
+
stroke: "red",
|
4703
4789
|
visible: false,
|
4704
4790
|
selectable: false,
|
4705
4791
|
type: 'line'
|
@@ -4820,7 +4906,7 @@ var initCanvas = function initCanvas() {
|
|
4820
4906
|
}
|
4821
4907
|
|
4822
4908
|
var removeItem = function removeItem(value) {
|
4823
|
-
//@ts-ignore
|
4909
|
+
//@ts-ignore
|
4824
4910
|
var index = use3dddPlus.getState().storeAllObject.findIndex(function (obj) {
|
4825
4911
|
return obj.id === value.id;
|
4826
4912
|
});
|
@@ -4941,6 +5027,19 @@ var initCanvas = function initCanvas() {
|
|
4941
5027
|
height1 = obj.height;
|
4942
5028
|
}
|
4943
5029
|
});
|
5030
|
+
canv.on('object:rotating', function (e) {
|
5031
|
+
var obj = e.target;
|
5032
|
+
if (obj.getBoundingRect().top < 0 || obj.getBoundingRect().left < 0) {
|
5033
|
+
obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top);
|
5034
|
+
obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left);
|
5035
|
+
obj.setCoords();
|
5036
|
+
}
|
5037
|
+
if (obj.getBoundingRect().top + obj.getBoundingRect().height > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width > obj.canvas.width) {
|
5038
|
+
obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top);
|
5039
|
+
obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left);
|
5040
|
+
obj.setCoords();
|
5041
|
+
}
|
5042
|
+
});
|
4944
5043
|
return canv;
|
4945
5044
|
};
|
4946
5045
|
|
@@ -6139,13 +6238,15 @@ var PopUpCanvas = function PopUpCanvas() {
|
|
6139
6238
|
// Iterate through objects on the canvas and check if any intersect with the mouse click
|
6140
6239
|
var removedColors = [];
|
6141
6240
|
use3dddPlus.getState().popUpCanvasUpdateModification(true);
|
6241
|
+
var color;
|
6142
6242
|
popupCanv.forEachObject(function (obj) {
|
6143
6243
|
if (obj.type === 'path') {
|
6144
6244
|
//@ts-ignore
|
6145
|
-
if (obj.containsPoint(mouseClick)) {
|
6245
|
+
if (obj.containsPoint(mouseClick) && !color) {
|
6146
6246
|
removedColors.push(obj.fill);
|
6147
6247
|
popupCanv.remove(obj);
|
6148
6248
|
popupCanv.renderAll();
|
6249
|
+
color = obj.fill;
|
6149
6250
|
}
|
6150
6251
|
}
|
6151
6252
|
});
|
@@ -6601,7 +6702,12 @@ var PopUpCanvas = function PopUpCanvas() {
|
|
6601
6702
|
textAlign: 'center',
|
6602
6703
|
marginBottom: '3px'
|
6603
6704
|
}
|
6604
|
-
},
|
6705
|
+
}, React.createElement("span", {
|
6706
|
+
style: {
|
6707
|
+
color: '#ffffff',
|
6708
|
+
mixBlendMode: 'difference'
|
6709
|
+
}
|
6710
|
+
}, c.updated));
|
6605
6711
|
})), React.createElement("div", {
|
6606
6712
|
className: "text-[#E11A38]",
|
6607
6713
|
style: {
|
@@ -6674,7 +6780,7 @@ var UploadLogo = function UploadLogo() {
|
|
6674
6780
|
_context.next = 5;
|
6675
6781
|
break;
|
6676
6782
|
}
|
6677
|
-
imageToSVG(data, true);
|
6783
|
+
imageToSVG(data, ext, true);
|
6678
6784
|
_context.next = 29;
|
6679
6785
|
break;
|
6680
6786
|
case 5:
|
@@ -6686,7 +6792,7 @@ var UploadLogo = function UploadLogo() {
|
|
6686
6792
|
return pdfConverter(data);
|
6687
6793
|
case 8:
|
6688
6794
|
pdfData = _context.sent;
|
6689
|
-
imageToSVG(pdfData);
|
6795
|
+
imageToSVG(pdfData, ext);
|
6690
6796
|
_context.next = 29;
|
6691
6797
|
break;
|
6692
6798
|
case 12:
|
@@ -6698,7 +6804,7 @@ var UploadLogo = function UploadLogo() {
|
|
6698
6804
|
return tiffConvert(data);
|
6699
6805
|
case 15:
|
6700
6806
|
tiffData = _context.sent;
|
6701
|
-
imageToSVG(tiffData);
|
6807
|
+
imageToSVG(tiffData, ext);
|
6702
6808
|
_context.next = 29;
|
6703
6809
|
break;
|
6704
6810
|
case 19:
|
@@ -6718,13 +6824,13 @@ var UploadLogo = function UploadLogo() {
|
|
6718
6824
|
fetch(aiToSvg.s3_file_url).then(function (response) {
|
6719
6825
|
return response.text();
|
6720
6826
|
}).then(function (svgText) {
|
6721
|
-
imageToSVG(svgText, false, false);
|
6827
|
+
imageToSVG(svgText, ext, false, false);
|
6722
6828
|
});
|
6723
6829
|
_context.next = 29;
|
6724
6830
|
break;
|
6725
6831
|
case 27:
|
6726
6832
|
objectURL = URL.createObjectURL(data);
|
6727
|
-
imageToSVG(objectURL);
|
6833
|
+
imageToSVG(objectURL, ext);
|
6728
6834
|
case 29:
|
6729
6835
|
setSelectedFile(null);
|
6730
6836
|
case 30:
|
@@ -8227,8 +8333,8 @@ var Rightmenu = function Rightmenu() {
|
|
8227
8333
|
});
|
8228
8334
|
_text.left = textSelected.left;
|
8229
8335
|
_text.top = textSelected.top;
|
8230
|
-
_text.width =
|
8231
|
-
_text.height =
|
8336
|
+
_text.width = _text.getBoundingRect().width;
|
8337
|
+
_text.height = _text.getBoundingRect().height;
|
8232
8338
|
_text.scaleX = textSelected.scaleX;
|
8233
8339
|
_text.scaleY = textSelected.scaleY;
|
8234
8340
|
// delete the active text object
|
@@ -8239,14 +8345,17 @@ var Rightmenu = function Rightmenu() {
|
|
8239
8345
|
// Add the text object keeping same properties
|
8240
8346
|
canvas.add(_text);
|
8241
8347
|
_text.setCoords();
|
8242
|
-
|
8243
|
-
use3dddPlus.getState().forIconCapture();
|
8244
|
-
_text['icon'] = use3dddPlus.getState().iconImage;
|
8245
|
-
updateStoreAllObject(_text);
|
8348
|
+
// set active object as path text
|
8246
8349
|
canvas.setActiveObject(_text);
|
8247
8350
|
use3dddPlus.setState({
|
8248
8351
|
activeSelection: _text
|
8249
8352
|
});
|
8353
|
+
//@ts-ignore
|
8354
|
+
use3dddPlus.getState().forIconCapture();
|
8355
|
+
_text['icon'] = use3dddPlus.getState().iconImage;
|
8356
|
+
updateStoreAllObject(_text);
|
8357
|
+
// canvas.setActiveObject(text);
|
8358
|
+
// use3dddPlus.setState({ activeSelection: text });
|
8250
8359
|
canvas.renderAll();
|
8251
8360
|
// cancel performing further functions & return back from function
|
8252
8361
|
return _context2.abrupt("return");
|
@@ -8459,14 +8568,33 @@ var Rightmenu = function Rightmenu() {
|
|
8459
8568
|
canvas.renderAll();
|
8460
8569
|
};
|
8461
8570
|
var handleSliderChange = function handleSliderChange(event) {
|
8462
|
-
var
|
8571
|
+
var fontSize = textSelected.fontSize;
|
8572
|
+
var toReduceSize = event.target.value - fontSize;
|
8573
|
+
var dublicateText = textSelected;
|
8574
|
+
// let brNew;
|
8575
|
+
dublicateText.set('fontSize', event.target.value);
|
8576
|
+
// if (currentSelection === 'path') {
|
8577
|
+
// textShapeChange(dublicateText.shapeType, true);
|
8578
|
+
// brNew = use3dddPlus.getState().activeSelection.getBoundingRect();
|
8579
|
+
// } else {
|
8580
|
+
// brNew = dublicateText.getBoundingRect();
|
8581
|
+
// }
|
8582
|
+
var brNew = dublicateText.getBoundingRect();
|
8463
8583
|
if (brNew.width + brNew.left >= textSelected.canvas.width || brNew.height + brNew.top >= textSelected.canvas.height || brNew.left < 0 || brNew.top < 0) {
|
8464
|
-
textSelected.set('fontSize', event.target.value - 1);
|
8465
8584
|
if (currentSelection === 'path') {
|
8585
|
+
textSelected.set('fontSize', event.target.value - (Math.sign(toReduceSize) >= 0 ? toReduceSize : 1));
|
8466
8586
|
textShapeChange(textSelected.shapeType, true);
|
8587
|
+
} else {
|
8588
|
+
if (brNew.left < 0) {
|
8589
|
+
textSelected.set('left', textSelected.left + 1);
|
8590
|
+
}
|
8591
|
+
if (brNew.top < 0) {
|
8592
|
+
textSelected.set('top', textSelected.top + 1);
|
8593
|
+
}
|
8594
|
+
textSelected.set('fontSize', event.target.value - (Math.sign(toReduceSize) >= 0 ? toReduceSize : 1));
|
8467
8595
|
}
|
8468
8596
|
} else {
|
8469
|
-
if (
|
8597
|
+
if (fontSize > event.target.value) {
|
8470
8598
|
textSelected.set('top', textSelected.top + 1);
|
8471
8599
|
textSelected.set('left', textSelected.left + 1);
|
8472
8600
|
} else {
|
@@ -8986,7 +9114,7 @@ var Rightmenu = function Rightmenu() {
|
|
8986
9114
|
id: "shapeSize",
|
8987
9115
|
name: "shapeSize",
|
8988
9116
|
step: "10",
|
8989
|
-
value:
|
9117
|
+
value: shapeSizeVal,
|
8990
9118
|
className: "border border-[#EBEBEB] py-[10px] pl-[16px] mb-[16.5px] w-[145px]",
|
8991
9119
|
onChange: textShapeSizeHandler
|
8992
9120
|
})))), currentSelection === 'group' && React.createElement(React.Fragment, null, React.createElement("div", {
|
@@ -9104,7 +9232,12 @@ var Rightmenu = function Rightmenu() {
|
|
9104
9232
|
textAlign: 'center',
|
9105
9233
|
marginBottom: '3px'
|
9106
9234
|
}
|
9107
|
-
},
|
9235
|
+
}, React.createElement("span", {
|
9236
|
+
style: {
|
9237
|
+
color: '#ffffff',
|
9238
|
+
mixBlendMode: 'difference'
|
9239
|
+
}
|
9240
|
+
}, c));
|
9108
9241
|
}))), React.createElement("button", {
|
9109
9242
|
type: "button",
|
9110
9243
|
className: "mt-3 inline-flex justify-center bg-white px-[110px] py-2 text-sm font-medium text-[#E11A38] shadow-sm ring-1 ring-inset ring-[#E11A38] hover:bg-gray-50 sm:mt-0 w-full",
|