ketcher-react 2.26.0-rc.6 → 2.26.0-rc.7

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
@@ -3798,7 +3798,7 @@ var zoom = {
3798
3798
 
3799
3799
  var openHelpLink = function openHelpLink() {
3800
3800
  var _window$open;
3801
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.26.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3801
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.26.0-rc.7\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3802
3802
  };
3803
3803
  var help = {
3804
3804
  help: {
@@ -16215,22 +16215,34 @@ function getElementsInRectangle(restruct, p0, p1) {
16215
16215
  var bottomLeftPosition = new ketcherCore.Vec2(x0, y1);
16216
16216
  var polygon = [topLeftPosition, topRightPosition, bottomRightPosition, bottomLeftPosition];
16217
16217
  restruct.bonds.forEach(function (bond, bid) {
16218
- if (struct.isBondFromMacromolecule(bid)) {
16218
+ if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16219
16219
  return;
16220
16220
  }
16221
- var centre = ketcherCore.Vec2.lc2(
16222
- restruct.atoms.get(bond.b.begin).a.pp, 0.5,
16223
- restruct.atoms.get(bond.b.end).a.pp, 0.5);
16224
- if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16221
+ var center;
16222
+ if (bond.b.isExternalBondBetweenMonomers(struct)) {
16223
+ var firstMonomer = struct.getGroupFromAtomId(bond.b.begin);
16224
+ var secondMonomer = struct.getGroupFromAtomId(bond.b.end);
16225
+ assert_1(firstMonomer);
16226
+ assert_1(secondMonomer);
16227
+ center = firstMonomer.pp && secondMonomer.pp ? ketcherCore.Vec2.centre(firstMonomer.pp, secondMonomer.pp) : bond.b.center;
16228
+ } else {
16229
+ center = bond.b.center;
16230
+ }
16231
+ if (center.x > x0 && center.x < x1 && center.y > y0 && center.y < y1) {
16225
16232
  bondList.push(bid);
16226
16233
  }
16227
16234
  });
16228
16235
  restruct.atoms.forEach(function (atom, aid) {
16229
16236
  var relatedFGId = ketcherCore.FunctionalGroup.findFunctionalGroupByAtom(functionalGroups, aid);
16230
- var reSGroup = restruct.sgroups.get(relatedFGId);
16231
- if (atom.a.pp.x > x0 && atom.a.pp.x < x1 && atom.a.pp.y > y0 && atom.a.pp.y < y1 && (!ketcherCore.FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) ||
16232
- aid === reSGroup.item.atoms[0])) {
16233
- atomList.push(aid);
16237
+ var sGroup = struct.sgroups.get(relatedFGId);
16238
+ if (struct.isAtomFromMacromolecule(aid)) {
16239
+ if (sGroup && sGroup.pp && sGroup.pp.x > x0 && sGroup.pp.x < x1 && sGroup.pp.y > y0 && sGroup.pp.y < y1) {
16240
+ atomList.push(aid);
16241
+ }
16242
+ } else {
16243
+ if (atom.a.pp.x > x0 && atom.a.pp.x < x1 && atom.a.pp.y > y0 && atom.a.pp.y < y1 && (!ketcherCore.FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) || aid === (sGroup === null || sGroup === void 0 ? void 0 : sGroup.atoms[0]))) {
16244
+ atomList.push(aid);
16245
+ }
16234
16246
  }
16235
16247
  });
16236
16248
  var rxnArrowsList = [];
@@ -16325,22 +16337,34 @@ function getElementsInPolygon(restruct, rr) {
16325
16337
  r[i] = new ketcherCore.Vec2(rr[i].x, rr[i].y);
16326
16338
  }
16327
16339
  restruct.bonds.forEach(function (bond, bid) {
16328
- if (struct.isAtomFromMacromolecule(bond.b.begin) || struct.isAtomFromMacromolecule(bond.b.end)) {
16340
+ if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16329
16341
  return;
16330
16342
  }
16331
- var centre = ketcherCore.Vec2.lc2(
16332
- restruct.atoms.get(bond.b.begin).a.pp, 0.5,
16333
- restruct.atoms.get(bond.b.end).a.pp, 0.5);
16334
- if (isPointInPolygon(r, centre) && !ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16343
+ var center;
16344
+ if (bond.b.isExternalBondBetweenMonomers(struct)) {
16345
+ var firstMonomer = struct.getGroupFromAtomId(bond.b.begin);
16346
+ var secondMonomer = struct.getGroupFromAtomId(bond.b.end);
16347
+ assert_1(firstMonomer);
16348
+ assert_1(secondMonomer);
16349
+ center = firstMonomer !== null && firstMonomer !== void 0 && firstMonomer.pp && secondMonomer !== null && secondMonomer !== void 0 && secondMonomer.pp ? ketcherCore.Vec2.centre(firstMonomer.pp, secondMonomer.pp) : bond.b.center;
16350
+ } else {
16351
+ center = bond.b.center;
16352
+ }
16353
+ if (isPointInPolygon(r, center)) {
16335
16354
  bondList.push(bid);
16336
16355
  }
16337
16356
  });
16338
16357
  restruct.atoms.forEach(function (atom, aid) {
16339
16358
  var relatedFGId = ketcherCore.FunctionalGroup.findFunctionalGroupByAtom(functionalGroups, aid);
16340
- var reSGroup = restruct.sgroups.get(relatedFGId);
16341
- if (isPointInPolygon(r, atom.a.pp) && (!ketcherCore.FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) ||
16342
- aid === reSGroup.item.atoms[0])) {
16343
- atomList.push(aid);
16359
+ var sGroup = struct.sgroups.get(relatedFGId);
16360
+ if (struct.isAtomFromMacromolecule(aid)) {
16361
+ if (sGroup && sGroup.pp && isPointInPolygon(r, sGroup.pp)) {
16362
+ atomList.push(aid);
16363
+ }
16364
+ } else {
16365
+ if (isPointInPolygon(r, atom.a.pp) && (!ketcherCore.FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) || aid === (sGroup === null || sGroup === void 0 ? void 0 : sGroup.atoms[0]))) {
16366
+ atomList.push(aid);
16367
+ }
16344
16368
  }
16345
16369
  });
16346
16370
  var rxnArrowsList = [];
@@ -24646,21 +24670,13 @@ var Editor$3 = function () {
24646
24670
  if (arguments.length === 0) {
24647
24671
  return this._selection;
24648
24672
  }
24649
- var struct = this.struct();
24650
24673
  var ReStruct = this.render.ctab;
24651
24674
  var selectAll = false;
24652
24675
  this._selection = null;
24653
24676
  if (ci === 'all') {
24654
24677
  selectAll = true;
24655
24678
  ci = structObjects.reduce(function (res, key) {
24656
- var restructItemsIds = Array.from(ReStruct[key].keys());
24657
- restructItemsIds = restructItemsIds.filter(function (restructItemId) {
24658
- return !struct.isTargetFromMacromolecule({
24659
- map: key,
24660
- id: restructItemId
24661
- });
24662
- });
24663
- res[key] = restructItemsIds;
24679
+ res[key] = Array.from(ReStruct[key].keys());
24664
24680
  return res;
24665
24681
  }, {});
24666
24682
  }
@@ -26474,24 +26490,46 @@ function getMenuPropsForClosestItem(editor, closestItem) {
26474
26490
  case 'bonds':
26475
26491
  {
26476
26492
  var functionalGroup = ketcherCore.FunctionalGroup.findFunctionalGroupByBond(struct, struct.functionalGroups, closestItem.id, true);
26477
- return functionalGroup === null || functionalGroup !== null && functionalGroup !== void 0 && functionalGroup.relatedSGroup.isSuperatomWithoutLabel ? {
26478
- id: CONTEXT_MENU_ID.FOR_BONDS,
26479
- bondIds: [closestItem.id]
26480
- } : {
26481
- id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26482
- functionalGroups: [functionalGroup]
26483
- };
26493
+ var noFunctionalGroup = functionalGroup === null || (functionalGroup === null || functionalGroup === void 0 ? void 0 : functionalGroup.relatedSGroup.isSuperatomWithoutLabel);
26494
+ var isMonomer = (functionalGroup === null || functionalGroup === void 0 ? void 0 : functionalGroup.relatedSGroup) instanceof ketcherCore.MonomerMicromolecule;
26495
+ if (noFunctionalGroup) {
26496
+ return {
26497
+ id: CONTEXT_MENU_ID.FOR_BONDS,
26498
+ bondIds: [closestItem.id]
26499
+ };
26500
+ } else if (isMonomer) {
26501
+ return {
26502
+ id: CONTEXT_MENU_ID.FOR_MACROMOLECULE,
26503
+ functionalGroups: [functionalGroup]
26504
+ };
26505
+ } else {
26506
+ return {
26507
+ id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26508
+ functionalGroups: [functionalGroup]
26509
+ };
26510
+ }
26484
26511
  }
26485
26512
  case 'atoms':
26486
26513
  {
26487
26514
  var _functionalGroup = ketcherCore.FunctionalGroup.findFunctionalGroupByAtom(struct.functionalGroups, closestItem.id, true);
26488
- return _functionalGroup === null || _functionalGroup !== null && _functionalGroup !== void 0 && _functionalGroup.relatedSGroup.isSuperatomWithoutLabel ? {
26489
- id: CONTEXT_MENU_ID.FOR_ATOMS,
26490
- atomIds: [closestItem.id]
26491
- } : {
26492
- id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26493
- functionalGroups: [_functionalGroup]
26494
- };
26515
+ var _noFunctionalGroup = _functionalGroup === null || (_functionalGroup === null || _functionalGroup === void 0 ? void 0 : _functionalGroup.relatedSGroup.isSuperatomWithoutLabel);
26516
+ var _isMonomer = (_functionalGroup === null || _functionalGroup === void 0 ? void 0 : _functionalGroup.relatedSGroup) instanceof ketcherCore.MonomerMicromolecule;
26517
+ if (_noFunctionalGroup) {
26518
+ return {
26519
+ id: CONTEXT_MENU_ID.FOR_ATOMS,
26520
+ atomIds: [closestItem.id]
26521
+ };
26522
+ } else if (_isMonomer) {
26523
+ return {
26524
+ id: CONTEXT_MENU_ID.FOR_MACROMOLECULE,
26525
+ functionalGroups: [_functionalGroup]
26526
+ };
26527
+ } else {
26528
+ return {
26529
+ id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26530
+ functionalGroups: [_functionalGroup]
26531
+ };
26532
+ }
26495
26533
  }
26496
26534
  case 'sgroups':
26497
26535
  case 'functionalGroups':
@@ -34849,8 +34887,8 @@ var KetcherBuilder = function () {
34849
34887
  cleanup = initApp(element, appRoot, staticResourcesUrl, {
34850
34888
  buttons: buttons || {},
34851
34889
  errorHandler: errorHandler || null,
34852
- version: "2.26.0-rc.6" ,
34853
- buildDate: "2024-10-25T09:50:21" ,
34890
+ version: "2.26.0-rc.7" ,
34891
+ buildDate: "2024-11-04T09:39:10" ,
34854
34892
  buildNumber: '',
34855
34893
  customButtons: customButtons || []
34856
34894
  }, structService, resolve, togglerComponent);