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.
@@ -3008,7 +3008,7 @@ var zoom = {
3008
3008
 
3009
3009
  var openHelpLink = function openHelpLink() {
3010
3010
  var _window$open;
3011
- 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();
3011
+ 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();
3012
3012
  };
3013
3013
  var help = {
3014
3014
  help: {
@@ -10851,7 +10851,7 @@ var BondTool = function () {
10851
10851
  existingBondId = _this$getExistingBond2[0],
10852
10852
  bond = _this$getExistingBond2[1];
10853
10853
  dragCtx.action = fromBondAddition(rnd.ctab, this.bondProps, beginAtom, endAtom, beginPos, endPos)[0];
10854
- if (existingBondId) {
10854
+ if (existingBondId !== null) {
10855
10855
  this.dragCtx.existedBond = bond;
10856
10856
  this.dragCtx.action.mergeWith(fromOneBondDeletion(rnd.ctab, existingBondId));
10857
10857
  }
@@ -11285,7 +11285,7 @@ function getElementsInRectangle(restruct, p0, p1) {
11285
11285
  var y1 = Math.max(p0.y, p1.y);
11286
11286
  restruct.bonds.forEach(function (bond, bid) {
11287
11287
  var centre = Vec2.lc2(restruct.atoms.get(bond.b.begin).a.pp, 0.5, restruct.atoms.get(bond.b.end).a.pp, 0.5);
11288
- if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) {
11288
+ if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
11289
11289
  bondList.push(bid);
11290
11290
  }
11291
11291
  });
@@ -11363,7 +11363,7 @@ function getElementsInPolygon(restruct, rr) {
11363
11363
  }
11364
11364
  restruct.bonds.forEach(function (bond, bid) {
11365
11365
  var centre = Vec2.lc2(restruct.atoms.get(bond.b.begin).a.pp, 0.5, restruct.atoms.get(bond.b.end).a.pp, 0.5);
11366
- if (isPointInPolygon(r, centre) && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) {
11366
+ if (isPointInPolygon(r, centre) && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
11367
11367
  bondList.push(bid);
11368
11368
  }
11369
11369
  });
@@ -11687,7 +11687,7 @@ var SGroupTool = function () {
11687
11687
  var _struct$bonds$get;
11688
11688
  var bondId = FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
11689
11689
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
11690
- if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
11690
+ if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
11691
11691
  bondResult.push(bondId);
11692
11692
  }
11693
11693
  }
@@ -12475,8 +12475,8 @@ var SelectTool = function () {
12475
12475
  var _struct$bonds$get;
12476
12476
  var bondId = FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
12477
12477
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
12478
- if (bondId !== null && !FunctionalGroup.isBondInContractedFunctionalGroup(
12479
- bondFromStruct, sgroups, functionalGroups, true)) bondResult.push(bondId);
12478
+ if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(
12479
+ bondFromStruct, sgroups, functionalGroups)) bondResult.push(bondId);
12480
12480
  }
12481
12481
  if (atomResult.length > 0) {
12482
12482
  var _iterator7 = _createForOfIteratorHelper$9(atomResult),
@@ -12752,7 +12752,7 @@ var EraserTool = function () {
12752
12752
  var bond = _step3.value;
12753
12753
  var bondId = FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, bond);
12754
12754
  var bondFromStruct = bondId !== null && ((_struct$bonds$get = struct.bonds.get(bondId)) === null || _struct$bonds$get === void 0 ? void 0 : _struct$bonds$get.b);
12755
- if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
12755
+ if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
12756
12756
  bondsResult.push(bondId);
12757
12757
  }
12758
12758
  }
@@ -12844,7 +12844,7 @@ var EraserTool = function () {
12844
12844
  var _restruct$bonds$get;
12845
12845
  var bondId = FunctionalGroup.bondsInFunctionalGroup(molecule, functionalGroups, ci.id);
12846
12846
  var bondFromStruct = bondId !== null && ((_restruct$bonds$get = restruct.bonds.get(bondId)) === null || _restruct$bonds$get === void 0 ? void 0 : _restruct$bonds$get.b);
12847
- if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups, true)) {
12847
+ if (bondFromStruct && !FunctionalGroup.isBondInContractedFunctionalGroup(bondFromStruct, sgroups, functionalGroups)) {
12848
12848
  bondResult.push(bondId);
12849
12849
  }
12850
12850
  }
@@ -14258,32 +14258,19 @@ var TemplateTool = function () {
14258
14258
  addSaltsAndSolventsOnCanvasWithoutMerge(restruct, this.template, dragCtx, this.editor);
14259
14259
  return true;
14260
14260
  } else if (((_ci = ci) === null || _ci === void 0 ? void 0 : _ci.map) === 'functionalGroups' && FunctionalGroup.isContractedFunctionalGroup(ci.id, functionalGroups) && this.mode === 'fg') {
14261
- var closestGroup = this.editor.struct().sgroups.get(ci.id);
14262
- var isClosestGroupAttached = closestGroup && closestGroup.isGroupAttached(this.editor.struct());
14263
- if (isClosestGroupAttached) {
14264
- var groupAttachmentAtomId = this.editor.struct().atoms.find(function (atomId) {
14265
- var _this$editor$struct$a;
14266
- return !!((_this$editor$struct$a = _this.editor.struct().atomGetNeighbors(atomId)) !== null && _this$editor$struct$a !== void 0 && _this$editor$struct$a.find(function (neighbor) {
14267
- return neighbor.aid === closestGroup.getAttAtomId(_this.editor.struct());
14268
- }));
14269
- });
14270
- if (groupAttachmentAtomId !== null) {
14271
- var _this$editor$struct$a2;
14272
- 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;
14273
- var eventPos = this.editor.render.page2obj(event);
14274
- var dist = Vec2.dist(targetPos, eventPos);
14275
- ci = {
14276
- map: 'atoms',
14277
- dist: dist,
14278
- id: groupAttachmentAtomId
14279
- };
14280
- }
14281
- }
14261
+ var _struct = this.editor.struct();
14262
+ var closestGroup = _struct.sgroups.get(ci.id);
14263
+ var attachmentAtomId = closestGroup.getAttAtomId(_struct);
14264
+ ci = {
14265
+ map: 'atoms',
14266
+ id: attachmentAtomId
14267
+ };
14282
14268
  this.editor.update(fromFragmentDeletion(this.editor.render.ctab, {
14283
- atoms: _toConsumableArray(SGroup.getAtoms(struct, closestGroup)),
14284
- bonds: _toConsumableArray(SGroup.getBonds(struct, closestGroup))
14269
+ atoms: _toConsumableArray(SGroup.getAtoms(_struct, closestGroup)).filter(function (atomId) {
14270
+ return atomId !== attachmentAtomId;
14271
+ }),
14272
+ bonds: _toConsumableArray(SGroup.getBonds(_struct, closestGroup))
14285
14273
  }));
14286
- if (!isClosestGroupAttached) ci = null;
14287
14274
  }
14288
14275
  if (!dragCtx.action) {
14289
14276
  if (!ci) {
@@ -15236,7 +15223,7 @@ function findClosestBond(restruct, pos, skip, minDist, scale) {
15236
15223
  if (bid === skipId) return;
15237
15224
  var a1 = restruct.atoms.get(bond.b.begin).a;
15238
15225
  var a2 = restruct.atoms.get(bond.b.end).a;
15239
- if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) return null;
15226
+ if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) return null;
15240
15227
  var mid = Vec2.lc2(a1.pp, 0.5, a2.pp, 0.5);
15241
15228
  var cdist = Vec2.dist(pos, mid);
15242
15229
  if (cdist < minCDist) {
@@ -15246,7 +15233,7 @@ function findClosestBond(restruct, pos, skip, minDist, scale) {
15246
15233
  });
15247
15234
  restruct.bonds.forEach(function (bond, bid) {
15248
15235
  if (bid === skipId) return;
15249
- if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups, true)) return null;
15236
+ if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) return null;
15250
15237
  var hb = restruct.molecule.halfBonds.get(bond.b.hb1);
15251
15238
  var dir = hb.dir;
15252
15239
  var norm = hb.norm;
@@ -22795,7 +22782,7 @@ var TemplateDialog = function TemplateDialog(props) {
22795
22782
  }), jsxs("div", {
22796
22783
  className: classes$8.tabsContent,
22797
22784
  children: [jsx(TabPanel, {
22798
- value: tab,
22785
+ value: thisInitialTab !== null ? initialTab : tab,
22799
22786
  index: TemplateTabs.TemplateLibrary,
22800
22787
  children: jsx("div", {
22801
22788
  children: Object.keys(filteredTemplateLib).length ? Object.keys(filteredTemplateLib).map(function (groupName) {
@@ -23662,8 +23649,8 @@ var KetcherBuilder = function () {
23662
23649
  initApp(element, staticResourcesUrl, {
23663
23650
  buttons: buttons || {},
23664
23651
  errorHandler: errorHandler || null,
23665
- version: "2.8.0-rc.4" ,
23666
- buildDate: "2023-02-22T09:16:14" ,
23652
+ version: "2.8.0-rc.5" ,
23653
+ buildDate: "2023-03-02T12:40:56" ,
23667
23654
  buildNumber: ''
23668
23655
  }, structService, resolve);
23669
23656
  });