@threedddplus/logoeditor 0.0.125 → 0.0.127

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.
@@ -2857,9 +2857,8 @@ var fabricSlice = function fabricSlice(set, get) {
2857
2857
  testSVG: function testSVG(data) {
2858
2858
  fabric.loadSVGFromURL(data, function (objects, options) {
2859
2859
  var loadedObject = fabric.util.groupSVGElements(objects, options);
2860
- // console.log(svg)
2861
- loadedObject.scaleToWidth(200);
2862
- loadedObject.scaleToHeight(200);
2860
+ loadedObject.scaleToWidth(450);
2861
+ loadedObject.scaleToHeight(450);
2863
2862
  var objImage = [];
2864
2863
  var _Fills = [];
2865
2864
  //@ts-ignore
@@ -4010,20 +4009,16 @@ var converterSlice = function converterSlice(set, get) {
4010
4009
  if (canvasToLoad === void 0) {
4011
4010
  canvasToLoad = use3dddPlus.getState().popupCanv;
4012
4011
  }
4013
- // console.log("svgstr\n",svgstr , 'color-VAL\n',colorValue ,'canvas\n' ,canvasToLoad);
4014
4012
  fabric.loadSVGFromString(
4015
4013
  //@ts-ignore
4016
4014
  new String(svgstr), function (objects, options) {
4017
4015
  var _canvasToLoad, _use3dddPlus$getState;
4018
4016
  var svgData = getDesignConceptSVGData(svgstr);
4019
- console.log(svgData);
4020
4017
  var loadedObject = fabric.util.groupSVGElements(objects, options);
4021
4018
  svgData.forEach(function (resItem) {
4022
4019
  var path;
4023
4020
  var node;
4024
4021
  objects == null ? void 0 : objects.forEach(function (item) {
4025
- //@ts-ignore
4026
- // console.log(item.id, res[0].path.replace("#", ""));
4027
4022
  //@ts-ignore
4028
4023
  if (item.id === resItem.path) {
4029
4024
  path = item;
@@ -4032,7 +4027,6 @@ var converterSlice = function converterSlice(set, get) {
4032
4027
  node = item;
4033
4028
  }
4034
4029
  });
4035
- console.log(node, path);
4036
4030
  if (node && path) {
4037
4031
  var _resItem$node$childre, _resItem$node$childre2;
4038
4032
  var fontSize = (_resItem$node$childre = resItem.node.children[0]) == null ? void 0 : (_resItem$node$childre2 = _resItem$node$childre.getAttribute('font-size')) == null ? void 0 : _resItem$node$childre2.replace('px', '');
@@ -4080,7 +4074,7 @@ var converterSlice = function converterSlice(set, get) {
4080
4074
  objImage.forEach(function (ele) {
4081
4075
  var _ele$id;
4082
4076
  ele.set({
4083
- strokeWidth: 0
4077
+ strokeWidth: 3
4084
4078
  });
4085
4079
  ele.set({
4086
4080
  id: (_ele$id = ele.id) != null ? _ele$id : use3dddPlus.getState().guid()
@@ -4183,28 +4177,7 @@ var converterSlice = function converterSlice(set, get) {
4183
4177
  // loadedObject.id = use3dddPlus.getState().guid();
4184
4178
  // loadedObject = new fabric.Group(objImage, options);
4185
4179
  (_use3dddPlus$getState = use3dddPlus.getState().popupCanv) == null ? void 0 : _use3dddPlus$getState.clear();
4186
- // use3dddPlus
4187
- // .getState()
4188
- // .popupCanv.setBackgroundColor(
4189
- // {
4190
- // source:
4191
- // 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/icons/checkerBoxBG.png',
4192
- // repeat: 'repeat',
4193
- // },
4194
- // use3dddPlus
4195
- // .getState()
4196
- // .popupCanv.renderAll.bind(use3dddPlus.getState().popupCanv),
4197
- // {
4198
- // backgroundImageOpacity: 1,
4199
- // scaleX: 1.1,
4200
- // scaleY: 1.1,
4201
- // backgroundRepeat: 'repeat',
4202
- // }
4203
- // );
4204
- // const canvas = use3dddPlus.getState().popupCanv;
4205
4180
  var gridSize = 83; // Size of each grid cell
4206
- // var canvasWidth = canvas.width;
4207
- // var canvasHeight = canvas.height;
4208
4181
  var numCols = Math.ceil(canvasWidth / gridSize);
4209
4182
  var numRows = Math.ceil(canvasHeight / gridSize);
4210
4183
  // Function to create a rectangle with checkerboard pattern
@@ -4272,28 +4245,6 @@ var converterSlice = function converterSlice(set, get) {
4272
4245
  use3dddPlus.getState().popUpCanvasUpdateModification(true);
4273
4246
  });
4274
4247
  };
4275
- // function convertToFabricUnits(valueWithUnit, canvasHeight = 500) {
4276
- // // Parse the value and unit from the string
4277
- // const matches = valueWithUnit.match(/^([\d.]+)(\D+)$/);
4278
- // if (!matches) {
4279
- // throw new Error("Invalid value format. Value must be in the format 'numberunit', e.g., '10px'.");
4280
- // }
4281
- // const value = parseFloat(matches[1]);
4282
- // const unit = matches[2];
4283
- // // Define conversion ratios for different units
4284
- // const conversionTable = {
4285
- // 'px': 1,
4286
- // 'em': 16, // Assuming 1em = 16px (default browser font size)
4287
- // 'rem': 16, // Same as em
4288
- // 'vh': canvasHeight / 100 // 1vh is 1% of canvas height
4289
- // };
4290
- // // Convert the value to pixels
4291
- // if (unit in conversionTable) {
4292
- // return value * conversionTable[unit];
4293
- // } else {
4294
- // throw new Error("Unsupported unit. Supported units are 'px', 'em', 'rem', 'vh'.");
4295
- // }
4296
- // }
4297
4248
  var getDesignConceptSVGData = function getDesignConceptSVGData(svgData) {
4298
4249
  var parser = new DOMParser();
4299
4250
  var xmlDoc = parser.parseFromString(svgData, 'image/svg+xml');
@@ -4416,22 +4367,26 @@ var converterSlice = function converterSlice(set, get) {
4416
4367
  if (convert === void 0) {
4417
4368
  convert = true;
4418
4369
  }
4419
- console.log("ext\n", ext);
4420
- // use3dddPlus.setState({ uploadImageModalDisplay: true });
4421
4370
  use3dddPlus.setState({
4422
4371
  loading: true
4423
4372
  });
4424
4373
  if (convert) {
4425
4374
  if (isSVG) {
4426
- console.log("entering into fileupload-->");
4427
- var reader = new FileReader();
4428
- reader.onload = function (e) {
4375
+ if (ext === "vectorSVG") {
4429
4376
  use3dddPlus.setState({
4430
- imageData: e.target.result
4377
+ imageData: data
4431
4378
  });
4432
- processImage(e.target.result, 8);
4433
- };
4434
- reader.readAsText(data);
4379
+ processImage(data, 8);
4380
+ } else {
4381
+ var reader = new FileReader();
4382
+ reader.onload = function (e) {
4383
+ use3dddPlus.setState({
4384
+ imageData: e.target.result
4385
+ });
4386
+ processImage(e.target.result, 8);
4387
+ };
4388
+ reader.readAsText(data);
4389
+ }
4435
4390
  } else {
4436
4391
  console.log("entering INTO ImageTracer-->");
4437
4392
  ImageTracer.imageToSVG(data, function (svgstr) {
@@ -7358,7 +7313,6 @@ var PopUpCanvas = function PopUpCanvas() {
7358
7313
  }));
7359
7314
  };
7360
7315
 
7361
- // import axios, { AxiosRequestConfig } from 'axios';
7362
7316
  var UploadLogo = function UploadLogo() {
7363
7317
  var _useState = useState(null),
7364
7318
  setSelectedFile = _useState[1];
@@ -7457,7 +7411,7 @@ var UploadLogo = function UploadLogo() {
7457
7411
  fetch(vectorizeImage.svg_url).then(function (response) {
7458
7412
  return response.text();
7459
7413
  }).then(function (svgText) {
7460
- imageToSVG(svgText, 'svg', false, false);
7414
+ imageToSVG(svgText, 'vectorSVG', true);
7461
7415
  use3dddPlus.setState({
7462
7416
  loading: false
7463
7417
  });