ketcher-react 2.8.0-rc.4 → 2.8.0-rc.5

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
@@ -3070,7 +3070,7 @@ var zoom = {
3070
3070
 
3071
3071
  var openHelpLink = function openHelpLink() {
3072
3072
  var _window$open;
3073
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.8.0-rc.4\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3073
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.8.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3074
3074
  };
3075
3075
  var help = {
3076
3076
  help: {
@@ -10913,7 +10913,7 @@ var BondTool = function () {
10913
10913
  existingBondId = _this$getExistingBond2[0],
10914
10914
  bond = _this$getExistingBond2[1];
10915
10915
  dragCtx.action = ketcherCore.fromBondAddition(rnd.ctab, this.bondProps, beginAtom, endAtom, beginPos, endPos)[0];
10916
- if (existingBondId) {
10916
+ if (existingBondId !== null) {
10917
10917
  this.dragCtx.existedBond = bond;
10918
10918
  this.dragCtx.action.mergeWith(ketcherCore.fromOneBondDeletion(rnd.ctab, existingBondId));
10919
10919
  }
@@ -11347,7 +11347,7 @@ function getElementsInRectangle(restruct, p0, p1) {
11347
11347
  var y1 = Math.max(p0.y, p1.y);
11348
11348
  restruct.bonds.forEach(function (bond, bid) {
11349
11349
  var centre = ketcherCore.Vec2.lc2(restruct.atoms.get(bond.b.begin).a.pp, 0.5, restruct.atoms.get(bond.b.end).a.pp, 0.5);
11350
- if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) {
11350
+ if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
11351
11351
  bondList.push(bid);
11352
11352
  }
11353
11353
  });
@@ -11425,7 +11425,7 @@ function getElementsInPolygon(restruct, rr) {
11425
11425
  }
11426
11426
  restruct.bonds.forEach(function (bond, bid) {
11427
11427
  var centre = ketcherCore.Vec2.lc2(restruct.atoms.get(bond.b.begin).a.pp, 0.5, restruct.atoms.get(bond.b.end).a.pp, 0.5);
11428
- if (isPointInPolygon(r, centre) && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) {
11428
+ if (isPointInPolygon(r, centre) && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
11429
11429
  bondList.push(bid);
11430
11430
  }
11431
11431
  });
@@ -11749,7 +11749,7 @@ var SGroupTool = function () {
11749
11749
  var _struct$bonds$get;
11750
11750
  var bondId = ketcherCore.FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
11751
11751
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
11752
- if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
11752
+ if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
11753
11753
  bondResult.push(bondId);
11754
11754
  }
11755
11755
  }
@@ -12537,8 +12537,8 @@ var SelectTool = function () {
12537
12537
  var _struct$bonds$get;
12538
12538
  var bondId = ketcherCore.FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
12539
12539
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
12540
- if (bondId !== null && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(
12541
- bondFromStruct, sgroups, functionalGroups, true)) bondResult.push(bondId);
12540
+ if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(
12541
+ bondFromStruct, sgroups, functionalGroups)) bondResult.push(bondId);
12542
12542
  }
12543
12543
  if (atomResult.length > 0) {
12544
12544
  var _iterator7 = _createForOfIteratorHelper$9(atomResult),
@@ -12814,7 +12814,7 @@ var EraserTool = function () {
12814
12814
  var bond = _step3.value;
12815
12815
  var bondId = ketcherCore.FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, bond);
12816
12816
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
12817
- if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
12817
+ if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
12818
12818
  bondsResult.push(bondId);
12819
12819
  }
12820
12820
  }
@@ -12906,7 +12906,7 @@ var EraserTool = function () {
12906
12906
  var _restruct$bonds$get;
12907
12907
  var bondId = ketcherCore.FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
12908
12908
  var bondFromStruct = bondId !== null && ((_restruct$bonds$get = restruct.bonds.get(bondId)) === null || _restruct$bonds$get === void 0 ? void 0 : _restruct$bonds$get.b);
12909
- if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
12909
+ if (bondFromStruct && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
12910
12910
  bondResult.push(bondId);
12911
12911
  }
12912
12912
  }
@@ -14320,32 +14320,19 @@ var TemplateTool = function () {
14320
14320
  addSaltsAndSolventsOnCanvasWithoutMerge(restruct, this.template, dragCtx, this.editor);
14321
14321
  return true;
14322
14322
  } else if (((_ci = ci) === null || _ci === void 0 ? void 0 : _ci.map) === 'functionalGroups' && ketcherCore.FunctionalGroup.isContractedFunctionalGroup(ci.id, functionalGroups) && this.mode === 'fg') {
14323
- var closestGroup = this.editor.struct().sgroups.get(ci.id);
14324
- var isClosestGroupAttached = closestGroup && closestGroup.isGroupAttached(this.editor.struct());
14325
- if (isClosestGroupAttached) {
14326
- var groupAttachmentAtomId = this.editor.struct().atoms.find(function (atomId) {
14327
- var _this$editor$struct$a;
14328
- return !!((_this$editor$struct$a = _this.editor.struct().atomGetNeighbors(atomId)) !== null && _this$editor$struct$a !== void 0 && _this$editor$struct$a.find(function (neighbor) {
14329
- return neighbor.aid === closestGroup.getAttAtomId(_this.editor.struct());
14330
- }));
14331
- });
14332
- if (groupAttachmentAtomId !== null) {
14333
- var _this$editor$struct$a2;
14334
- var targetPos = ((_this$editor$struct$a2 = this.editor.struct().atoms.get(groupAttachmentAtomId)) === null || _this$editor$struct$a2 === void 0 ? void 0 : _this$editor$struct$a2.pp) || dragCtx.xy0;
14335
- var eventPos = this.editor.render.page2obj(event);
14336
- var dist = ketcherCore.Vec2.dist(targetPos, eventPos);
14337
- ci = {
14338
- map: 'atoms',
14339
- dist: dist,
14340
- id: groupAttachmentAtomId
14341
- };
14342
- }
14343
- }
14323
+ var _struct = this.editor.struct();
14324
+ var closestGroup = _struct.sgroups.get(ci.id);
14325
+ var attachmentAtomId = closestGroup.getAttAtomId(_struct);
14326
+ ci = {
14327
+ map: 'atoms',
14328
+ id: attachmentAtomId
14329
+ };
14344
14330
  this.editor.update(ketcherCore.fromFragmentDeletion(this.editor.render.ctab, {
14345
- atoms: _toConsumableArray__default["default"](ketcherCore.SGroup.getAtoms(struct, closestGroup)),
14346
- bonds: _toConsumableArray__default["default"](ketcherCore.SGroup.getBonds(struct, closestGroup))
14331
+ atoms: _toConsumableArray__default["default"](ketcherCore.SGroup.getAtoms(_struct, closestGroup)).filter(function (atomId) {
14332
+ return atomId !== attachmentAtomId;
14333
+ }),
14334
+ bonds: _toConsumableArray__default["default"](ketcherCore.SGroup.getBonds(_struct, closestGroup))
14347
14335
  }));
14348
- if (!isClosestGroupAttached) ci = null;
14349
14336
  }
14350
14337
  if (!dragCtx.action) {
14351
14338
  if (!ci) {
@@ -15298,7 +15285,7 @@ function findClosestBond(restruct, pos, skip, minDist, scale) {
15298
15285
  if (bid === skipId) return;
15299
15286
  var a1 = restruct.atoms.get(bond.b.begin).a;
15300
15287
  var a2 = restruct.atoms.get(bond.b.end).a;
15301
- if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) return null;
15288
+ if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) return null;
15302
15289
  var mid = ketcherCore.Vec2.lc2(a1.pp, 0.5, a2.pp, 0.5);
15303
15290
  var cdist = ketcherCore.Vec2.dist(pos, mid);
15304
15291
  if (cdist < minCDist) {
@@ -15308,7 +15295,7 @@ function findClosestBond(restruct, pos, skip, minDist, scale) {
15308
15295
  });
15309
15296
  restruct.bonds.forEach(function (bond, bid) {
15310
15297
  if (bid === skipId) return;
15311
- if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) return null;
15298
+ if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) return null;
15312
15299
  var hb = restruct.molecule.halfBonds.get(bond.b.hb1);
15313
15300
  var dir = hb.dir;
15314
15301
  var norm = hb.norm;
@@ -22857,7 +22844,7 @@ var TemplateDialog = function TemplateDialog(props) {
22857
22844
  }), jsxRuntime.jsxs("div", {
22858
22845
  className: classes$8.tabsContent,
22859
22846
  children: [jsxRuntime.jsx(TabPanel, {
22860
- value: tab,
22847
+ value: thisInitialTab !== null ? initialTab : tab,
22861
22848
  index: TemplateTabs.TemplateLibrary,
22862
22849
  children: jsxRuntime.jsx("div", {
22863
22850
  children: Object.keys(filteredTemplateLib).length ? Object.keys(filteredTemplateLib).map(function (groupName) {
@@ -23724,8 +23711,8 @@ var KetcherBuilder = function () {
23724
23711
  initApp(element, staticResourcesUrl, {
23725
23712
  buttons: buttons || {},
23726
23713
  errorHandler: errorHandler || null,
23727
- version: "2.8.0-rc.4" ,
23728
- buildDate: "2023-02-22T09:16:14" ,
23714
+ version: "2.8.0-rc.5" ,
23715
+ buildDate: "2023-03-02T12:40:56" ,
23729
23716
  buildNumber: ''
23730
23717
  }, structService, resolve);
23731
23718
  });