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.modern.js
CHANGED
|
@@ -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.
|
|
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 (
|
|
16153
|
+
if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
|
|
16154
16154
|
return;
|
|
16155
16155
|
}
|
|
16156
|
-
var
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
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
|
|
16166
|
-
if (
|
|
16167
|
-
|
|
16168
|
-
|
|
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 (
|
|
16275
|
+
if (FunctionalGroup.isBondInContractedFunctionalGroup(bond.b, sGroups, functionalGroups)) {
|
|
16264
16276
|
return;
|
|
16265
16277
|
}
|
|
16266
|
-
var
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
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
|
|
16276
|
-
if (
|
|
16277
|
-
|
|
16278
|
-
|
|
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 = [];
|
|
@@ -23299,6 +23323,7 @@ var supportedMimesForRegex = supportedMimes.map(function (item) {
|
|
|
23299
23323
|
}).join('|');
|
|
23300
23324
|
var allowList = new RegExp("^image/(".concat(supportedMimesForRegex, ")$"));
|
|
23301
23325
|
var MIN_DIMENSION_SIZE = 16;
|
|
23326
|
+
var MIN_SIZELESS_IMAGE_SRC_LENGTH = 320;
|
|
23302
23327
|
var ImageTool = function () {
|
|
23303
23328
|
function ImageTool(editor) {
|
|
23304
23329
|
_classCallCheck$2(this, ImageTool);
|
|
@@ -23383,7 +23408,9 @@ var ImageTool = function () {
|
|
|
23383
23408
|
});
|
|
23384
23409
|
image.onload = function () {
|
|
23385
23410
|
_this.resetElementValue();
|
|
23386
|
-
|
|
23411
|
+
var isValidSize = image.width >= MIN_DIMENSION_SIZE && image.height >= MIN_DIMENSION_SIZE;
|
|
23412
|
+
var isValidSizeless = image.width === 0 && image.height === 0 && image.src.length >= MIN_SIZELESS_IMAGE_SRC_LENGTH;
|
|
23413
|
+
if (!isValidSize && !isValidSizeless) {
|
|
23387
23414
|
var _errorMessage = 'Image should be at least 16x16 pixels';
|
|
23388
23415
|
KetcherLogger.error("".concat(TAG, ":onLoad"), _errorMessage);
|
|
23389
23416
|
if (errorHandler) {
|
|
@@ -23391,8 +23418,9 @@ var ImageTool = function () {
|
|
|
23391
23418
|
}
|
|
23392
23419
|
return;
|
|
23393
23420
|
}
|
|
23394
|
-
var halfSize =
|
|
23395
|
-
|
|
23421
|
+
var halfSize = isValidSizeless ? new Vec2(MIN_DIMENSION_SIZE, MIN_DIMENSION_SIZE) : new Vec2(image.width / 2, image.height / 2);
|
|
23422
|
+
var halfSizeScaled = Scale.canvasToModel(halfSize, _this.editor.render.options);
|
|
23423
|
+
_this.editor.update(fromImageCreation(_this.editor.render.ctab, image.src, clickPosition, halfSizeScaled));
|
|
23396
23424
|
};
|
|
23397
23425
|
image.onerror = function (e) {
|
|
23398
23426
|
_this.resetElementValue();
|
|
@@ -24577,21 +24605,13 @@ var Editor$3 = function () {
|
|
|
24577
24605
|
if (arguments.length === 0) {
|
|
24578
24606
|
return this._selection;
|
|
24579
24607
|
}
|
|
24580
|
-
var struct = this.struct();
|
|
24581
24608
|
var ReStruct = this.render.ctab;
|
|
24582
24609
|
var selectAll = false;
|
|
24583
24610
|
this._selection = null;
|
|
24584
24611
|
if (ci === 'all') {
|
|
24585
24612
|
selectAll = true;
|
|
24586
24613
|
ci = structObjects.reduce(function (res, key) {
|
|
24587
|
-
|
|
24588
|
-
restructItemsIds = restructItemsIds.filter(function (restructItemId) {
|
|
24589
|
-
return !struct.isTargetFromMacromolecule({
|
|
24590
|
-
map: key,
|
|
24591
|
-
id: restructItemId
|
|
24592
|
-
});
|
|
24593
|
-
});
|
|
24594
|
-
res[key] = restructItemsIds;
|
|
24614
|
+
res[key] = Array.from(ReStruct[key].keys());
|
|
24595
24615
|
return res;
|
|
24596
24616
|
}, {});
|
|
24597
24617
|
}
|
|
@@ -26405,24 +26425,46 @@ function getMenuPropsForClosestItem(editor, closestItem) {
|
|
|
26405
26425
|
case 'bonds':
|
|
26406
26426
|
{
|
|
26407
26427
|
var functionalGroup = FunctionalGroup.findFunctionalGroupByBond(struct, struct.functionalGroups, closestItem.id, true);
|
|
26408
|
-
|
|
26409
|
-
|
|
26410
|
-
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26414
|
-
|
|
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
|
+
}
|
|
26415
26446
|
}
|
|
26416
26447
|
case 'atoms':
|
|
26417
26448
|
{
|
|
26418
26449
|
var _functionalGroup = FunctionalGroup.findFunctionalGroupByAtom(struct.functionalGroups, closestItem.id, true);
|
|
26419
|
-
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
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
|
+
}
|
|
26426
26468
|
}
|
|
26427
26469
|
case 'sgroups':
|
|
26428
26470
|
case 'functionalGroups':
|
|
@@ -34780,8 +34822,8 @@ var KetcherBuilder = function () {
|
|
|
34780
34822
|
cleanup = initApp(element, appRoot, staticResourcesUrl, {
|
|
34781
34823
|
buttons: buttons || {},
|
|
34782
34824
|
errorHandler: errorHandler || null,
|
|
34783
|
-
version: "2.26.0-rc.
|
|
34784
|
-
buildDate: "2024-
|
|
34825
|
+
version: "2.26.0-rc.7" ,
|
|
34826
|
+
buildDate: "2024-11-04T09:39:10" ,
|
|
34785
34827
|
buildNumber: '',
|
|
34786
34828
|
customButtons: customButtons || []
|
|
34787
34829
|
}, structService, resolve, togglerComponent);
|