ketcher-react 3.1.0-rc.6 → 3.2.0-rc.1

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/cjs/index.js CHANGED
@@ -3808,7 +3808,7 @@ var zoom = {
3808
3808
 
3809
3809
  var openHelpLink = function openHelpLink() {
3810
3810
  var _window$open;
3811
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.1.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3811
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.2.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3812
3812
  };
3813
3813
  var help = {
3814
3814
  help: {
@@ -24618,10 +24618,14 @@ var Editor$3 = function () {
24618
24618
  key: "renderAndRecoordinateStruct",
24619
24619
  value: function renderAndRecoordinateStruct(struct) {
24620
24620
  var needToCenterStruct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
24621
+ var x = arguments.length > 2 ? arguments[2] : undefined;
24622
+ var y = arguments.length > 3 ? arguments[3] : undefined;
24621
24623
  var action = ketcherCore.fromNewCanvas(this.render.ctab, struct);
24622
24624
  this.update(action);
24623
24625
  if (needToCenterStruct) {
24624
24626
  this.centerStruct();
24627
+ } else if (x != null && y != null) {
24628
+ this.positionStruct(x, y);
24625
24629
  }
24626
24630
  return this.render.ctab.molecule;
24627
24631
  }
@@ -24629,22 +24633,33 @@ var Editor$3 = function () {
24629
24633
  key: "struct",
24630
24634
  value: function struct(value) {
24631
24635
  var needToCenterStruct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
24636
+ var x = arguments.length > 2 ? arguments[2] : undefined;
24637
+ var y = arguments.length > 3 ? arguments[3] : undefined;
24632
24638
  if (arguments.length === 0) {
24633
24639
  return this.render.ctab.molecule;
24634
24640
  }
24635
24641
  ketcherCore.KetcherLogger.log('Editor.struct(), start', value, needToCenterStruct);
24636
24642
  this.selection(null);
24637
24643
  var struct = value || new ketcherCore.Struct();
24638
- var molecule = this.renderAndRecoordinateStruct(struct, needToCenterStruct);
24644
+ var molecule = this.renderAndRecoordinateStruct(struct, needToCenterStruct, x, y);
24639
24645
  this.hoverIcon.create();
24640
24646
  ketcherCore.KetcherLogger.log('Editor.struct(), end');
24641
24647
  return molecule;
24642
24648
  }
24643
24649
  }, {
24644
24650
  key: "structToAddFragment",
24645
- value: function structToAddFragment(value) {
24646
- var superStruct = value.mergeInto(this.render.ctab.molecule.clone());
24647
- return this.renderAndRecoordinateStruct(superStruct);
24651
+ value: function structToAddFragment(value, x, y) {
24652
+ if (x != null && y != null) {
24653
+ var position = new ketcherCore.Vec2(x, y);
24654
+ var _fromPaste = ketcherCore.fromPaste(this.render.ctab, value, position, 0),
24655
+ _fromPaste2 = _slicedToArray__default["default"](_fromPaste, 1),
24656
+ action = _fromPaste2[0];
24657
+ this.update(action, true);
24658
+ return this.render.ctab.molecule;
24659
+ } else {
24660
+ var superStruct = value.mergeInto(this.render.ctab.molecule.clone());
24661
+ return this.renderAndRecoordinateStruct(superStruct);
24662
+ }
24648
24663
  }
24649
24664
  }, {
24650
24665
  key: "setOptions",
@@ -24714,6 +24729,17 @@ var Editor$3 = function () {
24714
24729
  var action = ketcherCore.fromMultipleMove(structure, structureToMove, shiftVector);
24715
24730
  this.update(action, true);
24716
24731
  }
24732
+ }, {
24733
+ key: "positionStruct",
24734
+ value: function positionStruct(x, y) {
24735
+ var structure = this.render.ctab;
24736
+ var structCenter = getStructCenter(structure);
24737
+ var viewBoxCenter = new ketcherCore.Vec2(this.render.viewBox.minX + x, this.render.viewBox.minY + y);
24738
+ var shiftVector = viewBoxCenter.sub(structCenter);
24739
+ var structureToMove = getSelectionMap(structure);
24740
+ var action = ketcherCore.fromMultipleMove(structure, structureToMove, shiftVector);
24741
+ this.update(action, true);
24742
+ }
24717
24743
  }, {
24718
24744
  key: "zoomAccordingContent",
24719
24745
  value: function zoomAccordingContent(struct) {
@@ -35084,8 +35110,8 @@ var KetcherBuilder = function () {
35084
35110
  cleanup = initApp(element, appRoot, staticResourcesUrl, {
35085
35111
  buttons: buttons || {},
35086
35112
  errorHandler: errorHandler || null,
35087
- version: "3.1.0-rc.6" ,
35088
- buildDate: "2025-02-26T20:07:36" ,
35113
+ version: "3.2.0-rc.1" ,
35114
+ buildDate: "2025-03-04T14:36:10" ,
35089
35115
  buildNumber: '',
35090
35116
  customButtons: customButtons || []
35091
35117
  }, structService, resolve, togglerComponent);
@@ -35377,7 +35403,7 @@ var ModeControl = function ModeControl(_ref3) {
35377
35403
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35378
35404
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
35379
35405
  var MacromoleculesEditor = React.lazy(function () {
35380
- return Promise.resolve().then(function () { return require('./index.modern-1cbc2dff.js'); });
35406
+ return Promise.resolve().then(function () { return require('./index.modern-dc72bcd6.js'); });
35381
35407
  });
35382
35408
  var Editor = function Editor(props) {
35383
35409
  var _useState = React.useState(false),