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.
@@ -3733,7 +3733,7 @@ var zoom = {
3733
3733
 
3734
3734
  var openHelpLink = function openHelpLink() {
3735
3735
  var _window$open;
3736
- 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();
3736
+ 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();
3737
3737
  };
3738
3738
  var help = {
3739
3739
  help: {
@@ -16150,22 +16150,34 @@ function getElementsInRectangle(restruct, p0, p1) {
16150
16150
  var bottomLeftPosition = new Vec2(x0, y1);
16151
16151
  var polygon = [topLeftPosition, topRightPosition, bottomRightPosition, bottomLeftPosition];
16152
16152
  restruct.bonds.forEach(function (bond, bid) {
16153
- if (struct.isBondFromMacromolecule(bid)) {
16153
+ if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16154
16154
  return;
16155
16155
  }
16156
- var centre = Vec2.lc2(
16157
- restruct.atoms.get(bond.b.begin).a.pp, 0.5,
16158
- restruct.atoms.get(bond.b.end).a.pp, 0.5);
16159
- if (centre.x > x0 && centre.x < x1 && centre.y > y0 && centre.y < y1 && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16156
+ var center;
16157
+ if (bond.b.isExternalBondBetweenMonomers(struct)) {
16158
+ var firstMonomer = struct.getGroupFromAtomId(bond.b.begin);
16159
+ var secondMonomer = struct.getGroupFromAtomId(bond.b.end);
16160
+ assert_1(firstMonomer);
16161
+ assert_1(secondMonomer);
16162
+ center = firstMonomer.pp && secondMonomer.pp ? Vec2.centre(firstMonomer.pp, secondMonomer.pp) : bond.b.center;
16163
+ } else {
16164
+ center = bond.b.center;
16165
+ }
16166
+ if (center.x > x0 && center.x < x1 && center.y > y0 && center.y < y1) {
16160
16167
  bondList.push(bid);
16161
16168
  }
16162
16169
  });
16163
16170
  restruct.atoms.forEach(function (atom, aid) {
16164
16171
  var relatedFGId = FunctionalGroup.findFunctionalGroupByAtom(functionalGroups, aid);
16165
- var reSGroup = restruct.sgroups.get(relatedFGId);
16166
- if (atom.a.pp.x > x0 && atom.a.pp.x < x1 && atom.a.pp.y > y0 && atom.a.pp.y < y1 && (!FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) ||
16167
- aid === reSGroup.item.atoms[0])) {
16168
- atomList.push(aid);
16172
+ var sGroup = struct.sgroups.get(relatedFGId);
16173
+ if (struct.isAtomFromMacromolecule(aid)) {
16174
+ if (sGroup && sGroup.pp && sGroup.pp.x > x0 && sGroup.pp.x < x1 && sGroup.pp.y > y0 && sGroup.pp.y < y1) {
16175
+ atomList.push(aid);
16176
+ }
16177
+ } else {
16178
+ if (atom.a.pp.x > x0 && atom.a.pp.x < x1 && atom.a.pp.y > y0 && atom.a.pp.y < y1 && (!FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) || aid === (sGroup === null || sGroup === void 0 ? void 0 : sGroup.atoms[0]))) {
16179
+ atomList.push(aid);
16180
+ }
16169
16181
  }
16170
16182
  });
16171
16183
  var rxnArrowsList = [];
@@ -16260,22 +16272,34 @@ function getElementsInPolygon(restruct, rr) {
16260
16272
  r[i] = new Vec2(rr[i].x, rr[i].y);
16261
16273
  }
16262
16274
  restruct.bonds.forEach(function (bond, bid) {
16263
- if (struct.isAtomFromMacromolecule(bond.b.begin) || struct.isAtomFromMacromolecule(bond.b.end)) {
16275
+ if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16264
16276
  return;
16265
16277
  }
16266
- var centre = Vec2.lc2(
16267
- restruct.atoms.get(bond.b.begin).a.pp, 0.5,
16268
- restruct.atoms.get(bond.b.end).a.pp, 0.5);
16269
- if (isPointInPolygon(r, centre) && !FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
16278
+ var center;
16279
+ if (bond.b.isExternalBondBetweenMonomers(struct)) {
16280
+ var firstMonomer = struct.getGroupFromAtomId(bond.b.begin);
16281
+ var secondMonomer = struct.getGroupFromAtomId(bond.b.end);
16282
+ assert_1(firstMonomer);
16283
+ assert_1(secondMonomer);
16284
+ center = firstMonomer !== null && firstMonomer !== void 0 && firstMonomer.pp && secondMonomer !== null && secondMonomer !== void 0 && secondMonomer.pp ? Vec2.centre(firstMonomer.pp, secondMonomer.pp) : bond.b.center;
16285
+ } else {
16286
+ center = bond.b.center;
16287
+ }
16288
+ if (isPointInPolygon(r, center)) {
16270
16289
  bondList.push(bid);
16271
16290
  }
16272
16291
  });
16273
16292
  restruct.atoms.forEach(function (atom, aid) {
16274
16293
  var relatedFGId = FunctionalGroup.findFunctionalGroupByAtom(functionalGroups, aid);
16275
- var reSGroup = restruct.sgroups.get(relatedFGId);
16276
- if (isPointInPolygon(r, atom.a.pp) && (!FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) ||
16277
- aid === reSGroup.item.atoms[0])) {
16278
- atomList.push(aid);
16294
+ var sGroup = struct.sgroups.get(relatedFGId);
16295
+ if (struct.isAtomFromMacromolecule(aid)) {
16296
+ if (sGroup && sGroup.pp && isPointInPolygon(r, sGroup.pp)) {
16297
+ atomList.push(aid);
16298
+ }
16299
+ } else {
16300
+ if (isPointInPolygon(r, atom.a.pp) && (!FunctionalGroup.isAtomInContractedFunctionalGroup(atom.a, sGroups, functionalGroups, true) || aid === (sGroup === null || sGroup === void 0 ? void 0 : sGroup.atoms[0]))) {
16301
+ atomList.push(aid);
16302
+ }
16279
16303
  }
16280
16304
  });
16281
16305
  var rxnArrowsList = [];
@@ -24581,21 +24605,13 @@ var Editor$3 = function () {
24581
24605
  if (arguments.length === 0) {
24582
24606
  return this._selection;
24583
24607
  }
24584
- var struct = this.struct();
24585
24608
  var ReStruct = this.render.ctab;
24586
24609
  var selectAll = false;
24587
24610
  this._selection = null;
24588
24611
  if (ci === 'all') {
24589
24612
  selectAll = true;
24590
24613
  ci = structObjects.reduce(function (res, key) {
24591
- var restructItemsIds = Array.from(ReStruct[key].keys());
24592
- restructItemsIds = restructItemsIds.filter(function (restructItemId) {
24593
- return !struct.isTargetFromMacromolecule({
24594
- map: key,
24595
- id: restructItemId
24596
- });
24597
- });
24598
- res[key] = restructItemsIds;
24614
+ res[key] = Array.from(ReStruct[key].keys());
24599
24615
  return res;
24600
24616
  }, {});
24601
24617
  }
@@ -26409,24 +26425,46 @@ function getMenuPropsForClosestItem(editor, closestItem) {
26409
26425
  case 'bonds':
26410
26426
  {
26411
26427
  var functionalGroup = FunctionalGroup.findFunctionalGroupByBond(struct, struct.functionalGroups, closestItem.id, true);
26412
- return functionalGroup === null || functionalGroup !== null && functionalGroup !== void 0 && functionalGroup.relatedSGroup.isSuperatomWithoutLabel ? {
26413
- id: CONTEXT_MENU_ID.FOR_BONDS,
26414
- bondIds: [closestItem.id]
26415
- } : {
26416
- id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26417
- functionalGroups: [functionalGroup]
26418
- };
26428
+ var noFunctionalGroup = functionalGroup === null || (functionalGroup === null || functionalGroup === void 0 ? void 0 : functionalGroup.relatedSGroup.isSuperatomWithoutLabel);
26429
+ var isMonomer = (functionalGroup === null || functionalGroup === void 0 ? void 0 : functionalGroup.relatedSGroup) instanceof MonomerMicromolecule;
26430
+ if (noFunctionalGroup) {
26431
+ return {
26432
+ id: CONTEXT_MENU_ID.FOR_BONDS,
26433
+ bondIds: [closestItem.id]
26434
+ };
26435
+ } else if (isMonomer) {
26436
+ return {
26437
+ id: CONTEXT_MENU_ID.FOR_MACROMOLECULE,
26438
+ functionalGroups: [functionalGroup]
26439
+ };
26440
+ } else {
26441
+ return {
26442
+ id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26443
+ functionalGroups: [functionalGroup]
26444
+ };
26445
+ }
26419
26446
  }
26420
26447
  case 'atoms':
26421
26448
  {
26422
26449
  var _functionalGroup = FunctionalGroup.findFunctionalGroupByAtom(struct.functionalGroups, closestItem.id, true);
26423
- return _functionalGroup === null || _functionalGroup !== null && _functionalGroup !== void 0 && _functionalGroup.relatedSGroup.isSuperatomWithoutLabel ? {
26424
- id: CONTEXT_MENU_ID.FOR_ATOMS,
26425
- atomIds: [closestItem.id]
26426
- } : {
26427
- id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26428
- functionalGroups: [_functionalGroup]
26429
- };
26450
+ var _noFunctionalGroup = _functionalGroup === null || (_functionalGroup === null || _functionalGroup === void 0 ? void 0 : _functionalGroup.relatedSGroup.isSuperatomWithoutLabel);
26451
+ var _isMonomer = (_functionalGroup === null || _functionalGroup === void 0 ? void 0 : _functionalGroup.relatedSGroup) instanceof MonomerMicromolecule;
26452
+ if (_noFunctionalGroup) {
26453
+ return {
26454
+ id: CONTEXT_MENU_ID.FOR_ATOMS,
26455
+ atomIds: [closestItem.id]
26456
+ };
26457
+ } else if (_isMonomer) {
26458
+ return {
26459
+ id: CONTEXT_MENU_ID.FOR_MACROMOLECULE,
26460
+ functionalGroups: [_functionalGroup]
26461
+ };
26462
+ } else {
26463
+ return {
26464
+ id: CONTEXT_MENU_ID.FOR_FUNCTIONAL_GROUPS,
26465
+ functionalGroups: [_functionalGroup]
26466
+ };
26467
+ }
26430
26468
  }
26431
26469
  case 'sgroups':
26432
26470
  case 'functionalGroups':
@@ -34784,8 +34822,8 @@ var KetcherBuilder = function () {
34784
34822
  cleanup = initApp(element, appRoot, staticResourcesUrl, {
34785
34823
  buttons: buttons || {},
34786
34824
  errorHandler: errorHandler || null,
34787
- version: "2.26.0-rc.6" ,
34788
- buildDate: "2024-10-25T09:50:21" ,
34825
+ version: "2.26.0-rc.7" ,
34826
+ buildDate: "2024-11-04T09:39:10" ,
34789
34827
  buildNumber: '',
34790
34828
  customButtons: customButtons || []
34791
34829
  }, structService, resolve, togglerComponent);