ketcher-react 2.26.0-rc.5 → 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 +89 -47
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +89 -47
- package/dist/index.modern.js.map +1 -1
- package/dist/script/editor/Editor.d.ts +1 -1
- package/package.json +1 -1
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.
|
|
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 (
|
|
16218
|
+
if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
|
|
16219
16219
|
return;
|
|
16220
16220
|
}
|
|
16221
|
-
var
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
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
|
|
16231
|
-
if (
|
|
16232
|
-
|
|
16233
|
-
|
|
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 (
|
|
16340
|
+
if (ketcherCore.FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
|
|
16329
16341
|
return;
|
|
16330
16342
|
}
|
|
16331
|
-
var
|
|
16332
|
-
|
|
16333
|
-
|
|
16334
|
-
|
|
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
|
|
16341
|
-
if (
|
|
16342
|
-
|
|
16343
|
-
|
|
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 = [];
|
|
@@ -23364,6 +23388,7 @@ var supportedMimesForRegex = supportedMimes.map(function (item) {
|
|
|
23364
23388
|
}).join('|');
|
|
23365
23389
|
var allowList = new RegExp("^image/(".concat(supportedMimesForRegex, ")$"));
|
|
23366
23390
|
var MIN_DIMENSION_SIZE = 16;
|
|
23391
|
+
var MIN_SIZELESS_IMAGE_SRC_LENGTH = 320;
|
|
23367
23392
|
var ImageTool = function () {
|
|
23368
23393
|
function ImageTool(editor) {
|
|
23369
23394
|
_classCallCheck__default["default"](this, ImageTool);
|
|
@@ -23448,7 +23473,9 @@ var ImageTool = function () {
|
|
|
23448
23473
|
});
|
|
23449
23474
|
image.onload = function () {
|
|
23450
23475
|
_this.resetElementValue();
|
|
23451
|
-
|
|
23476
|
+
var isValidSize = image.width >= MIN_DIMENSION_SIZE && image.height >= MIN_DIMENSION_SIZE;
|
|
23477
|
+
var isValidSizeless = image.width === 0 && image.height === 0 && image.src.length >= MIN_SIZELESS_IMAGE_SRC_LENGTH;
|
|
23478
|
+
if (!isValidSize && !isValidSizeless) {
|
|
23452
23479
|
var _errorMessage = 'Image should be at least 16x16 pixels';
|
|
23453
23480
|
ketcherCore.KetcherLogger.error("".concat(TAG, ":onLoad"), _errorMessage);
|
|
23454
23481
|
if (errorHandler) {
|
|
@@ -23456,8 +23483,9 @@ var ImageTool = function () {
|
|
|
23456
23483
|
}
|
|
23457
23484
|
return;
|
|
23458
23485
|
}
|
|
23459
|
-
var halfSize = ketcherCore.
|
|
23460
|
-
|
|
23486
|
+
var halfSize = isValidSizeless ? new ketcherCore.Vec2(MIN_DIMENSION_SIZE, MIN_DIMENSION_SIZE) : new ketcherCore.Vec2(image.width / 2, image.height / 2);
|
|
23487
|
+
var halfSizeScaled = ketcherCore.Scale.canvasToModel(halfSize, _this.editor.render.options);
|
|
23488
|
+
_this.editor.update(ketcherCore.fromImageCreation(_this.editor.render.ctab, image.src, clickPosition, halfSizeScaled));
|
|
23461
23489
|
};
|
|
23462
23490
|
image.onerror = function (e) {
|
|
23463
23491
|
_this.resetElementValue();
|
|
@@ -24642,21 +24670,13 @@ var Editor$3 = function () {
|
|
|
24642
24670
|
if (arguments.length === 0) {
|
|
24643
24671
|
return this._selection;
|
|
24644
24672
|
}
|
|
24645
|
-
var struct = this.struct();
|
|
24646
24673
|
var ReStruct = this.render.ctab;
|
|
24647
24674
|
var selectAll = false;
|
|
24648
24675
|
this._selection = null;
|
|
24649
24676
|
if (ci === 'all') {
|
|
24650
24677
|
selectAll = true;
|
|
24651
24678
|
ci = structObjects.reduce(function (res, key) {
|
|
24652
|
-
|
|
24653
|
-
restructItemsIds = restructItemsIds.filter(function (restructItemId) {
|
|
24654
|
-
return !struct.isTargetFromMacromolecule({
|
|
24655
|
-
map: key,
|
|
24656
|
-
id: restructItemId
|
|
24657
|
-
});
|
|
24658
|
-
});
|
|
24659
|
-
res[key] = restructItemsIds;
|
|
24679
|
+
res[key] = Array.from(ReStruct[key].keys());
|
|
24660
24680
|
return res;
|
|
24661
24681
|
}, {});
|
|
24662
24682
|
}
|
|
@@ -26470,24 +26490,46 @@ function getMenuPropsForClosestItem(editor, closestItem) {
|
|
|
26470
26490
|
case 'bonds':
|
|
26471
26491
|
{
|
|
26472
26492
|
var functionalGroup = ketcherCore.FunctionalGroup.findFunctionalGroupByBond(struct, struct.functionalGroups, closestItem.id, true);
|
|
26473
|
-
|
|
26474
|
-
|
|
26475
|
-
|
|
26476
|
-
|
|
26477
|
-
|
|
26478
|
-
|
|
26479
|
-
|
|
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
|
+
}
|
|
26480
26511
|
}
|
|
26481
26512
|
case 'atoms':
|
|
26482
26513
|
{
|
|
26483
26514
|
var _functionalGroup = ketcherCore.FunctionalGroup.findFunctionalGroupByAtom(struct.functionalGroups, closestItem.id, true);
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
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
|
+
}
|
|
26491
26533
|
}
|
|
26492
26534
|
case 'sgroups':
|
|
26493
26535
|
case 'functionalGroups':
|
|
@@ -34845,8 +34887,8 @@ var KetcherBuilder = function () {
|
|
|
34845
34887
|
cleanup = initApp(element, appRoot, staticResourcesUrl, {
|
|
34846
34888
|
buttons: buttons || {},
|
|
34847
34889
|
errorHandler: errorHandler || null,
|
|
34848
|
-
version: "2.26.0-rc.
|
|
34849
|
-
buildDate: "2024-
|
|
34890
|
+
version: "2.26.0-rc.7" ,
|
|
34891
|
+
buildDate: "2024-11-04T09:39:10" ,
|
|
34850
34892
|
buildNumber: '',
|
|
34851
34893
|
customButtons: customButtons || []
|
|
34852
34894
|
}, structService, resolve, togglerComponent);
|