ketcher-react 2.17.0-rc.2 → 2.17.0-rc.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/index.js CHANGED
@@ -3665,7 +3665,7 @@ var zoom = {
3665
3665
 
3666
3666
  var openHelpLink = function openHelpLink() {
3667
3667
  var _window$open;
3668
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.17.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3668
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.17.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3669
3669
  };
3670
3670
  var help = {
3671
3671
  help: {
@@ -21307,28 +21307,17 @@ var TemplatePreview = function () {
21307
21307
  this.previousPosition = this.position;
21308
21308
  this.editor.render.update(false, null);
21309
21309
  } else {
21310
- this.moveFloatingPreview(previewTarget, event);
21310
+ this.moveFloatingPreview();
21311
21311
  }
21312
21312
  }
21313
21313
  }
21314
21314
  }, {
21315
21315
  key: "moveFloatingPreview",
21316
- value: function moveFloatingPreview(previewTarget, event) {
21316
+ value: function moveFloatingPreview() {
21317
21317
  var dist = this.position.sub(this.previousPosition);
21318
21318
  this.previousPosition = this.position;
21319
21319
  ketcherCore.fromMultipleMove(this.restruct, this.floatingPreview, dist);
21320
21320
  this.editor.render.update(false, null);
21321
- this.hoverFusedItems(previewTarget, event);
21322
- }
21323
- }, {
21324
- key: "hoverFusedItems",
21325
- value: function hoverFusedItems(closestItem, event) {
21326
- if (this.mode === 'fg') {
21327
- this.editor.hover(closestItem, null, event);
21328
- } else {
21329
- var mergeItems = ketcherCore.getItemsToFuse(this.editor, this.floatingPreview);
21330
- this.editor.hover(ketcherCore.getHoverToFuse(mergeItems));
21331
- }
21332
21321
  }
21333
21322
  }, {
21334
21323
  key: "showFloatingPreview",
@@ -21645,10 +21634,10 @@ var TemplateTool = function () {
21645
21634
  var _fromTemplateOnBondAc = ketcherCore.fromTemplateOnBondAction(this.editor.render.ctab, this.template, ci.id, this.editor.event, dragCtx.sign1 * dragCtx.sign2 > 0, false),
21646
21635
  _fromTemplateOnBondAc2 = _slicedToArray__default["default"](_fromTemplateOnBondAc, 2),
21647
21636
  _action = _fromTemplateOnBondAc2[0],
21648
- _pasteItems = _fromTemplateOnBondAc2[1];
21637
+ pasteItems = _fromTemplateOnBondAc2[1];
21649
21638
  dragCtx.action = _action;
21650
21639
  this.editor.update(dragCtx.action, true);
21651
- dragCtx.mergeItems = ketcherCore.getItemsToFuse(this.editor, _pasteItems);
21640
+ dragCtx.mergeItems = ketcherCore.getItemsToFuse(this.editor, pasteItems);
21652
21641
  this.editor.hover(ketcherCore.getHoverToFuse(dragCtx.mergeItems));
21653
21642
  }
21654
21643
  return true;
@@ -21687,7 +21676,6 @@ var TemplateTool = function () {
21687
21676
  }
21688
21677
  dragCtx.angle = degrees;
21689
21678
  var action = null;
21690
- var pasteItems;
21691
21679
  if (!ci) {
21692
21680
  var _this$template;
21693
21681
  var isAddingFunctionalGroup = (_this$template = this.template) === null || _this$template === void 0 || (_this$template = _this$template.molecule) === null || _this$template === void 0 ? void 0 : _this$template.sgroups.size;
@@ -21695,23 +21683,17 @@ var TemplateTool = function () {
21695
21683
  return true;
21696
21684
  }
21697
21685
  var _fromTemplateOnCanvas = ketcherCore.fromTemplateOnCanvas(this.editor.render.ctab, this.template, targetPos, angle);
21698
- var _fromTemplateOnCanvas2 = _slicedToArray__default["default"](_fromTemplateOnCanvas, 2);
21686
+ var _fromTemplateOnCanvas2 = _slicedToArray__default["default"](_fromTemplateOnCanvas, 1);
21699
21687
  action = _fromTemplateOnCanvas2[0];
21700
- pasteItems = _fromTemplateOnCanvas2[1];
21701
21688
  } else if ((ci === null || ci === void 0 ? void 0 : ci.map) === 'atoms' || (ci === null || ci === void 0 ? void 0 : ci.map) === 'functionalGroups') {
21702
21689
  var _atomId = getTargetAtomId(this.struct, ci);
21703
21690
  var _fromTemplateOnAtom = ketcherCore.fromTemplateOnAtom(this.editor.render.ctab, this.template, _atomId, angle, extraBond);
21704
- var _fromTemplateOnAtom2 = _slicedToArray__default["default"](_fromTemplateOnAtom, 2);
21691
+ var _fromTemplateOnAtom2 = _slicedToArray__default["default"](_fromTemplateOnAtom, 1);
21705
21692
  action = _fromTemplateOnAtom2[0];
21706
- pasteItems = _fromTemplateOnAtom2[1];
21707
21693
  dragCtx.extra_bond = extraBond;
21708
21694
  }
21709
21695
  dragCtx.action = action;
21710
21696
  this.editor.update(dragCtx.action, true);
21711
- if (!this.isModeFunctionalGroup) {
21712
- dragCtx.mergeItems = ketcherCore.getItemsToFuse(this.editor, pasteItems);
21713
- this.editor.hover(ketcherCore.getHoverToFuse(dragCtx.mergeItems));
21714
- }
21715
21697
  if (this.targetGroupsIds.length) this.targetGroupsIds.length = 0;
21716
21698
  return true;
21717
21699
  }
@@ -21741,12 +21723,17 @@ var TemplateTool = function () {
21741
21723
  return true;
21742
21724
  }
21743
21725
  var action, functionalGroupRemoveAction;
21744
- var pasteItems = null;
21745
21726
  if (((_ci = ci) === null || _ci === void 0 ? void 0 : _ci.map) === 'functionalGroups' && ketcherCore.FunctionalGroup.isContractedFunctionalGroup(ci.id, this.functionalGroups) && this.isModeFunctionalGroup && this.targetGroupsIds.length) {
21746
21727
  var _restruct = this.editor.render.ctab;
21747
21728
  var functionalGroupToReplace = this.struct.sgroups.get(ci.id);
21748
21729
  if (this.isSaltOrSolvent && functionalGroupToReplace.isGroupAttached(this.struct)) {
21749
- addSaltsAndSolventsOnCanvasWithoutMerge(_restruct, this.template, dragCtx, this.editor);
21730
+ addOnCanvasWithoutMerge({
21731
+ restruct: _restruct,
21732
+ template: this.template,
21733
+ dragCtx: dragCtx,
21734
+ editor: this.editor,
21735
+ event: event
21736
+ });
21750
21737
  return true;
21751
21738
  }
21752
21739
  functionalGroupRemoveAction = new ketcherCore.Action();
@@ -21766,24 +21753,31 @@ var TemplateTool = function () {
21766
21753
  }
21767
21754
  if (!dragCtx.action) {
21768
21755
  if (!ci) {
21769
- var _fromTemplateOnCanvas3 = ketcherCore.fromTemplateOnCanvas(restruct, this.template, dragCtx.xy0, 0);
21770
- var _fromTemplateOnCanvas4 = _slicedToArray__default["default"](_fromTemplateOnCanvas3, 2);
21771
- action = _fromTemplateOnCanvas4[0];
21772
- pasteItems = _fromTemplateOnCanvas4[1];
21773
- dragCtx.action = action;
21774
- this.editor.update(action, true);
21756
+ addOnCanvasWithoutMerge({
21757
+ restruct: restruct,
21758
+ template: this.template,
21759
+ dragCtx: dragCtx,
21760
+ editor: this.editor,
21761
+ event: event
21762
+ });
21763
+ return true;
21775
21764
  } else if (ci.map === 'atoms') {
21776
21765
  var _restruct$atoms$get2;
21777
21766
  var degree = (_restruct$atoms$get2 = restruct.atoms.get(ci.id)) === null || _restruct$atoms$get2 === void 0 ? void 0 : _restruct$atoms$get2.a.neighbors.length;
21778
21767
  if (degree && degree >= 1 && this.isSaltOrSolvent) {
21779
- addSaltsAndSolventsOnCanvasWithoutMerge(restruct, this.template, dragCtx, this.editor);
21768
+ addOnCanvasWithoutMerge({
21769
+ restruct: restruct,
21770
+ template: this.template,
21771
+ dragCtx: dragCtx,
21772
+ editor: this.editor,
21773
+ event: event
21774
+ });
21780
21775
  return true;
21781
21776
  }
21782
21777
  var angle = getAngleFromEvent(event, ci, restruct);
21783
21778
  var _fromTemplateOnAtom3 = ketcherCore.fromTemplateOnAtom(restruct, this.template, ci.id, angle, false);
21784
- var _fromTemplateOnAtom4 = _slicedToArray__default["default"](_fromTemplateOnAtom3, 2);
21779
+ var _fromTemplateOnAtom4 = _slicedToArray__default["default"](_fromTemplateOnAtom3, 1);
21785
21780
  action = _fromTemplateOnAtom4[0];
21786
- pasteItems = _fromTemplateOnAtom4[1];
21787
21781
  if (functionalGroupRemoveAction) {
21788
21782
  action = functionalGroupRemoveAction.mergeWith(action);
21789
21783
  }
@@ -21803,11 +21797,6 @@ var TemplateTool = function () {
21803
21797
  return true;
21804
21798
  }
21805
21799
  }
21806
- this.editor.selection(null);
21807
- if (!dragCtx.mergeItems && pasteItems && !this.isModeFunctionalGroup) {
21808
- dragCtx.mergeItems = ketcherCore.getItemsToFuse(this.editor, pasteItems);
21809
- }
21810
- dragCtx.action = dragCtx.action ? ketcherCore.fromItemsFuse(restruct, dragCtx.mergeItems).mergeWith(dragCtx.action) : ketcherCore.fromItemsFuse(restruct, dragCtx.mergeItems);
21811
21800
  var _iterator = _createForOfIteratorHelper$1(restruct.molecule.bonds.keys()),
21812
21801
  _step;
21813
21802
  try {
@@ -21836,11 +21825,7 @@ var TemplateTool = function () {
21836
21825
  if (completeAction && !completeAction.isDummy()) {
21837
21826
  this.editor.update(completeAction);
21838
21827
  }
21839
- this.editor.hover(this.editor.findItem(event, this.findItems), null, event);
21840
- this.editor.event.showInfo.dispatch(null);
21841
- this.editor.event.message.dispatch({
21842
- info: false
21843
- });
21828
+ this.editor.hover(this.editor.findItem(event, null), null, event);
21844
21829
  return true;
21845
21830
  }
21846
21831
  }, {
@@ -21864,13 +21849,18 @@ var TemplateTool = function () {
21864
21849
  }]);
21865
21850
  return TemplateTool;
21866
21851
  }();
21867
- function addSaltsAndSolventsOnCanvasWithoutMerge(restruct, template, dragCtx, editor) {
21868
- var _fromTemplateOnCanvas5 = ketcherCore.fromTemplateOnCanvas(restruct, template, dragCtx.xy0, 0),
21869
- _fromTemplateOnCanvas6 = _slicedToArray__default["default"](_fromTemplateOnCanvas5, 1),
21870
- action = _fromTemplateOnCanvas6[0];
21852
+ function addOnCanvasWithoutMerge(_ref5) {
21853
+ var restruct = _ref5.restruct,
21854
+ template = _ref5.template,
21855
+ dragCtx = _ref5.dragCtx,
21856
+ editor = _ref5.editor,
21857
+ event = _ref5.event;
21858
+ var _fromTemplateOnCanvas3 = ketcherCore.fromTemplateOnCanvas(restruct, template, dragCtx.xy0, 0, false),
21859
+ _fromTemplateOnCanvas4 = _slicedToArray__default["default"](_fromTemplateOnCanvas3, 1),
21860
+ action = _fromTemplateOnCanvas4[0];
21871
21861
  editor.update(action);
21872
21862
  editor.selection(null);
21873
- editor.hover(null);
21863
+ editor.hover(editor.findItem(event, null), null, event);
21874
21864
  editor.event.message.dispatch({
21875
21865
  info: false
21876
21866
  });
@@ -32444,8 +32434,8 @@ var KetcherBuilder = function () {
32444
32434
  initApp(element, appRoot, staticResourcesUrl, {
32445
32435
  buttons: buttons || {},
32446
32436
  errorHandler: errorHandler || null,
32447
- version: "2.17.0-rc.2" ,
32448
- buildDate: "2023-12-14T08:19:09" ,
32437
+ version: "2.17.0-rc.3" ,
32438
+ buildDate: "2023-12-25T13:38:31" ,
32449
32439
  buildNumber: ''
32450
32440
  }, structService, resolve, togglerComponent);
32451
32441
  });