@threedddplus/logoeditor 0.0.112-2 → 0.0.112-3
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 +20 -74
- 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 +20 -74
- package/dist/logoeditor.esm.js.map +1 -1
- package/package.json +131 -131
package/dist/logoeditor.esm.js
CHANGED
@@ -8837,6 +8837,7 @@ var Rightmenu = function Rightmenu() {
|
|
8837
8837
|
}
|
8838
8838
|
var newTextPath = new fabric.Path(p.output());
|
8839
8839
|
// add new textPath
|
8840
|
+
console.log("---<", textSelected, textSelected.width, textSelected.height);
|
8840
8841
|
canvas.add(newTextPath);
|
8841
8842
|
newTextPath['pathData'] = textSelected.pathData;
|
8842
8843
|
newTextPath['colorFill'] = textSelected.colorFill;
|
@@ -8855,16 +8856,18 @@ var Rightmenu = function Rightmenu() {
|
|
8855
8856
|
newTextPath['textAlign'] = textSelected.textAlign;
|
8856
8857
|
newTextPath['fontStyle'] = textSelected.fontStyle;
|
8857
8858
|
newTextPath['text'] = textSelected.text;
|
8859
|
+
//@ts-ignore
|
8860
|
+
var dims = newTextPath._calcDimensions();
|
8858
8861
|
// Set the same position scale matching with existing text
|
8859
8862
|
newTextPath.left = textSelected.left;
|
8860
8863
|
newTextPath.top = textSelected.top;
|
8861
8864
|
newTextPath.width = textSelected.width;
|
8862
8865
|
newTextPath.height = textSelected.height;
|
8863
|
-
newTextPath.scaleX = textSelected.scaleX;
|
8864
|
-
newTextPath.scaleY = textSelected.scaleY;
|
8866
|
+
newTextPath.scaleX = textSelected.scaleX * (textSelected.width / dims.width);
|
8867
|
+
newTextPath.scaleY = textSelected.scaleY * (textSelected.width / dims.width);
|
8865
8868
|
newTextPath.setCoords();
|
8866
8869
|
//@ts-ignore
|
8867
|
-
|
8870
|
+
// let dims = newTextPath._calcDimensions();
|
8868
8871
|
newTextPath.width = dims.width;
|
8869
8872
|
newTextPath.height = dims.height;
|
8870
8873
|
// delete the text object
|
@@ -8905,7 +8908,7 @@ var Rightmenu = function Rightmenu() {
|
|
8905
8908
|
};
|
8906
8909
|
var textShapeChange = /*#__PURE__*/function () {
|
8907
8910
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, textChange, fontSize, charSpacing, strokeWidth, fontWeight, textAlign, fontStyle) {
|
8908
|
-
var pathData, p, shapeType, text, _text, fabricPath, dims, newTextPath,
|
8911
|
+
var pathData, p, shapeType, text, _text, fabricPath, dims, newTextPath, _dims, activeObj;
|
8909
8912
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
8910
8913
|
while (1) switch (_context2.prev = _context2.next) {
|
8911
8914
|
case 0:
|
@@ -8995,6 +8998,7 @@ var Rightmenu = function Rightmenu() {
|
|
8995
8998
|
colorFill: textSelected.colorFill,
|
8996
8999
|
fontWeight: fontWeight
|
8997
9000
|
});
|
9001
|
+
// let dims = fabricPath._calcDimensions();
|
8998
9002
|
text.left = textSelected.left;
|
8999
9003
|
text.top = textSelected.top;
|
9000
9004
|
text.width = textSelected.width;
|
@@ -9057,10 +9061,10 @@ var Rightmenu = function Rightmenu() {
|
|
9057
9061
|
});
|
9058
9062
|
_text.left = textSelected.left;
|
9059
9063
|
_text.top = textSelected.top;
|
9060
|
-
_text.
|
9061
|
-
_text.
|
9062
|
-
|
9063
|
-
_text.
|
9064
|
+
_text.scaleX = textSelected.scaleX * (textSelected.width / _text.width);
|
9065
|
+
_text.scaleY = textSelected.scaleY * (textSelected.width / _text.width);
|
9066
|
+
window["textObj"] = _text;
|
9067
|
+
_text.setCoords();
|
9064
9068
|
_text.id = textSelected.id;
|
9065
9069
|
// delete the active text object
|
9066
9070
|
canvas.remove(textSelected);
|
@@ -9153,16 +9157,15 @@ var Rightmenu = function Rightmenu() {
|
|
9153
9157
|
fabricPath['fontStyle'] = textSelected.fontStyle;
|
9154
9158
|
fabricPath['text'] = textSelected.text;
|
9155
9159
|
fabricPath['id'] = textSelected.id;
|
9156
|
-
|
9160
|
+
//@ts-ignore
|
9161
|
+
dims = fabricPath._calcDimensions(); // Set the same position scale matching with existing text
|
9157
9162
|
fabricPath.left = textSelected.left;
|
9158
9163
|
fabricPath.top = textSelected.top;
|
9159
9164
|
fabricPath.width = textSelected.width;
|
9160
9165
|
fabricPath.height = textSelected.height;
|
9161
|
-
fabricPath.scaleX = textSelected.scaleX;
|
9162
|
-
fabricPath.scaleY = textSelected.scaleY;
|
9166
|
+
fabricPath.scaleX = textSelected.scaleX * (textSelected.width / dims.width);
|
9167
|
+
fabricPath.scaleY = textSelected.scaleY * (textSelected.width / dims.width);
|
9163
9168
|
fabricPath.setCoords();
|
9164
|
-
//@ts-ignore
|
9165
|
-
dims = fabricPath._calcDimensions();
|
9166
9169
|
fabricPath.width = dims.width;
|
9167
9170
|
fabricPath.height = dims.height;
|
9168
9171
|
// var sel = new fabric.ActiveSelection(fabricPath, { canvas: canvas });
|
@@ -9202,8 +9205,10 @@ var Rightmenu = function Rightmenu() {
|
|
9202
9205
|
newTextPath['top'] = textSelected.top;
|
9203
9206
|
newTextPath['width'] = textSelected.width;
|
9204
9207
|
newTextPath['height'] = textSelected.height;
|
9205
|
-
|
9206
|
-
|
9208
|
+
//@ts-ignore
|
9209
|
+
_dims = newTextPath._calcDimensions();
|
9210
|
+
newTextPath['scaleX'] = textSelected.scaleX * (textSelected.width / _dims.width);
|
9211
|
+
newTextPath['scaleY'] = textSelected.scaleY * (textSelected.width / _dims.width);
|
9207
9212
|
newTextPath['id'] = textSelected.id;
|
9208
9213
|
// delete the active text object
|
9209
9214
|
activeObj = canvas.getActiveObject();
|
@@ -9218,8 +9223,6 @@ var Rightmenu = function Rightmenu() {
|
|
9218
9223
|
activeSelection: newTextPath
|
9219
9224
|
});
|
9220
9225
|
newTextPath.setCoords();
|
9221
|
-
//@ts-ignore
|
9222
|
-
_dims = newTextPath._calcDimensions();
|
9223
9226
|
newTextPath.width = _dims.width;
|
9224
9227
|
newTextPath.height = _dims.height;
|
9225
9228
|
canvas.renderAll();
|
@@ -9228,29 +9231,7 @@ var Rightmenu = function Rightmenu() {
|
|
9228
9231
|
updateStoreAllObject(newTextPath);
|
9229
9232
|
}
|
9230
9233
|
canvas.renderAll();
|
9231
|
-
// setTimeout(() => {
|
9232
|
-
// reduceFontSize();
|
9233
|
-
// }, 500);
|
9234
9234
|
reduceFontSize();
|
9235
|
-
// canvas.renderAll();
|
9236
|
-
// let brNew = use3dddPlus.getState().activeSelection.getBoundingRect();
|
9237
|
-
// while (
|
9238
|
-
// Math.ceil(brNew.width + brNew.left + 45) >= Math.floor(canvas.width) ||
|
9239
|
-
// Math.ceil(brNew.height + brNew.top + 10) >= Math.floor(canvas.height) ||
|
9240
|
-
// Math.ceil(brNew.left) < 0 ||
|
9241
|
-
// Math.ceil(brNew.top) < 0
|
9242
|
-
// ) {
|
9243
|
-
// textSelected.set('fontSize', textSelected.fontSize - 0.1);
|
9244
|
-
// canvas.remove(canvas.getActiveObject());
|
9245
|
-
// await textShapeChange(textSelected.shapeType, true);
|
9246
|
-
// const activeObj = canvas.getActiveObject();
|
9247
|
-
// brNew.left = activeObj.left;
|
9248
|
-
// brNew.width = activeObj.width;
|
9249
|
-
// brNew.top = activeObj.top;
|
9250
|
-
// brNew.height = activeObj.height;
|
9251
|
-
// textSelected.setCoords();
|
9252
|
-
// canvas.renderAll();
|
9253
|
-
// }
|
9254
9235
|
case 103:
|
9255
9236
|
case "end":
|
9256
9237
|
return _context2.stop();
|
@@ -9296,41 +9277,6 @@ var Rightmenu = function Rightmenu() {
|
|
9296
9277
|
return;
|
9297
9278
|
}
|
9298
9279
|
};
|
9299
|
-
/*
|
9300
|
-
const reduceFontSize = async () => {
|
9301
|
-
let brNew = textSelected.getBoundingRect();
|
9302
|
-
let canvasWidth = 0;
|
9303
|
-
let canvasHeight = 0;
|
9304
|
-
if (textSelected && textSelected.canvas && textSelected.canvas.width) {
|
9305
|
-
canvasWidth = textSelected.canvas.width;
|
9306
|
-
canvasHeight = textSelected.canvas.height;
|
9307
|
-
} else {
|
9308
|
-
canvasWidth = canvas.width;
|
9309
|
-
canvasHeight = canvas.height;
|
9310
|
-
}
|
9311
|
-
while (
|
9312
|
-
Math.ceil(brNew.width + brNew.left + 45) > Math.floor(canvasWidth) ||
|
9313
|
-
Math.ceil(brNew.height + brNew.top + 10) > Math.floor(canvasHeight) ||
|
9314
|
-
Math.ceil(brNew.left) < 0 ||
|
9315
|
-
Math.ceil(brNew.top) < 0
|
9316
|
-
) {
|
9317
|
-
textSelected.set('fontSize', textSelected.fontSize - 0.1);
|
9318
|
-
if (currentSelection === 'path') {
|
9319
|
-
await textShapeChange(textSelected.shapeType, true);
|
9320
|
-
canvas.renderAll();
|
9321
|
-
const activeObj = canvas.getActiveObject();
|
9322
|
-
brNew.left = activeObj.left;
|
9323
|
-
brNew.width = activeObj.width;
|
9324
|
-
brNew.top = activeObj.top;
|
9325
|
-
brNew.height = activeObj.height;
|
9326
|
-
} else {
|
9327
|
-
brNew = textSelected.getBoundingRect();
|
9328
|
-
}
|
9329
|
-
textSelected.setCoords();
|
9330
|
-
// canvas.renderAll();
|
9331
|
-
}
|
9332
|
-
};
|
9333
|
-
*/
|
9334
9280
|
var reduceFontSize = /*#__PURE__*/function () {
|
9335
9281
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
9336
9282
|
var brNew, canvasWidth, canvasHeight, _activeObj;
|