ketcher-react 2.9.0-rc.3 → 2.9.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.
- package/dist/index.js +165 -114
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +165 -114
- package/dist/index.modern.js.map +1 -1
- package/dist/script/editor/Editor.d.ts +5 -4
- package/dist/script/editor/HoverIcon.d.ts +31 -0
- package/dist/script/editor/tool/atom.d.ts +0 -2
- package/dist/script/editor/tool/template.d.ts +2 -3
- package/dist/script/ui/state/modal/atoms.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -2956,7 +2956,7 @@ var templates = templates$1.reduce(function (res, struct, i) {
|
|
|
2956
2956
|
var zoomList = [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.7, 2, 2.5, 3, 3.5, 4];
|
|
2957
2957
|
var zoom = {
|
|
2958
2958
|
zoom: {
|
|
2959
|
-
shortcut: ['
|
|
2959
|
+
shortcut: ['Mod+Shift+0'],
|
|
2960
2960
|
selected: function selected(editor) {
|
|
2961
2961
|
return editor.zoom();
|
|
2962
2962
|
},
|
|
@@ -3010,7 +3010,7 @@ var zoom = {
|
|
|
3010
3010
|
|
|
3011
3011
|
var openHelpLink = function openHelpLink() {
|
|
3012
3012
|
var _window$open;
|
|
3013
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.
|
|
3013
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3014
3014
|
};
|
|
3015
3015
|
var help = {
|
|
3016
3016
|
help: {
|
|
@@ -10352,6 +10352,7 @@ function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateColle
|
|
|
10352
10352
|
var _bondProps = new WeakMap();
|
|
10353
10353
|
var AtomTool = function () {
|
|
10354
10354
|
function AtomTool(editor, atomProps) {
|
|
10355
|
+
var _ElementColor$atomPro;
|
|
10355
10356
|
_classCallCheck(this, AtomTool);
|
|
10356
10357
|
_classPrivateFieldInitSpec$2(this, _bondProps, {
|
|
10357
10358
|
writable: true,
|
|
@@ -10363,8 +10364,10 @@ var AtomTool = function () {
|
|
|
10363
10364
|
type: 1,
|
|
10364
10365
|
stereo: Bond$2.PATTERN.STEREO.NONE
|
|
10365
10366
|
});
|
|
10366
|
-
this.editor.hoverIcon.show()
|
|
10367
|
-
this.editor.
|
|
10367
|
+
this.editor.hoverIcon.show();
|
|
10368
|
+
this.editor.hoverIcon.label = atomProps.label;
|
|
10369
|
+
this.editor.hoverIcon.fill = (_ElementColor$atomPro = ElementColor[atomProps.label]) !== null && _ElementColor$atomPro !== void 0 ? _ElementColor$atomPro : '#000000';
|
|
10370
|
+
this.editor.hoverIcon.updatePosition();
|
|
10368
10371
|
if (editor.selection()) {
|
|
10369
10372
|
var _editor$selection;
|
|
10370
10373
|
if ((_editor$selection = editor.selection()) !== null && _editor$selection !== void 0 && _editor$selection.atoms) {
|
|
@@ -10448,32 +10451,13 @@ var AtomTool = function () {
|
|
|
10448
10451
|
};
|
|
10449
10452
|
}
|
|
10450
10453
|
}
|
|
10451
|
-
}, {
|
|
10452
|
-
key: "mouseleave",
|
|
10453
|
-
value: function mouseleave() {
|
|
10454
|
-
this.editor.hoverIcon.hide();
|
|
10455
|
-
}
|
|
10456
|
-
}, {
|
|
10457
|
-
key: "mouseover",
|
|
10458
|
-
value: function mouseover() {
|
|
10459
|
-
this.editor.hoverIcon.show();
|
|
10460
|
-
this.editor.updateHoverIconPosition();
|
|
10461
|
-
}
|
|
10462
10454
|
}, {
|
|
10463
10455
|
key: "mousemove",
|
|
10464
10456
|
value: function mousemove(event) {
|
|
10465
10457
|
this.editor.hoverIcon.show();
|
|
10466
10458
|
var rnd = this.editor.render;
|
|
10467
|
-
var layerX = event.layerX,
|
|
10468
|
-
layerY = event.layerY;
|
|
10469
10459
|
if (!this.dragCtx || !this.dragCtx.item) {
|
|
10470
|
-
|
|
10471
|
-
height = _this$editor$hoverIco.height,
|
|
10472
|
-
width = _this$editor$hoverIco.width;
|
|
10473
|
-
this.editor.hoverIcon.attr({
|
|
10474
|
-
x: layerX - width / 2,
|
|
10475
|
-
y: layerY - height / 2
|
|
10476
|
-
});
|
|
10460
|
+
this.editor.hoverIcon.updatePosition();
|
|
10477
10461
|
this.editor.hover(this.editor.findItem(event, ['atoms', 'functionalGroups']), null, event);
|
|
10478
10462
|
return;
|
|
10479
10463
|
}
|
|
@@ -12223,16 +12207,15 @@ function updateOnlyChangedProperties(atomId, userChangedAtom, molecule) {
|
|
|
12223
12207
|
}, {});
|
|
12224
12208
|
}
|
|
12225
12209
|
function updateSelectedAtoms(_ref) {
|
|
12226
|
-
var
|
|
12210
|
+
var atoms = _ref.atoms,
|
|
12227
12211
|
changeAtomPromise = _ref.changeAtomPromise,
|
|
12228
12212
|
editor = _ref.editor;
|
|
12229
12213
|
var action = new Action();
|
|
12230
12214
|
var struct = editor.render.ctab;
|
|
12231
12215
|
var molecule = struct.molecule;
|
|
12232
|
-
if (
|
|
12233
|
-
var selectionAtoms = selection.atoms;
|
|
12216
|
+
if (atoms) {
|
|
12234
12217
|
Promise.resolve(changeAtomPromise).then(function (userChangedAtom) {
|
|
12235
|
-
|
|
12218
|
+
atoms.forEach(function (atomId) {
|
|
12236
12219
|
var atomWithChangedProperties = updateOnlyChangedProperties(atomId, userChangedAtom, molecule);
|
|
12237
12220
|
action.mergeWith(fromAtomsAttrs(struct, atomId, atomWithChangedProperties, false));
|
|
12238
12221
|
});
|
|
@@ -12564,7 +12547,7 @@ var SelectTool = function () {
|
|
|
12564
12547
|
var atoms = getSelectedAtoms(selection, molecule);
|
|
12565
12548
|
var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
|
|
12566
12549
|
updateSelectedAtoms({
|
|
12567
|
-
selection: selection,
|
|
12550
|
+
atoms: (selection === null || selection === void 0 ? void 0 : selection.atoms) || [],
|
|
12568
12551
|
editor: editor,
|
|
12569
12552
|
changeAtomPromise: changeAtomPromise
|
|
12570
12553
|
});
|
|
@@ -13142,11 +13125,12 @@ function ownKeys$O(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
13142
13125
|
function _objectSpread$O(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$O(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$O(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13143
13126
|
var PasteTool = function () {
|
|
13144
13127
|
function PasteTool(editor, struct) {
|
|
13128
|
+
var _struct$functionalGro;
|
|
13145
13129
|
_classCallCheck(this, PasteTool);
|
|
13146
13130
|
this.editor = editor;
|
|
13147
13131
|
this.editor.selection(null);
|
|
13148
13132
|
this.struct = struct;
|
|
13149
|
-
this.isSingleContractedGroup = struct.isSingleGroup() && !struct.functionalGroups.get(0).isExpanded;
|
|
13133
|
+
this.isSingleContractedGroup = struct.isSingleGroup() && !((_struct$functionalGro = struct.functionalGroups.get(0)) !== null && _struct$functionalGro !== void 0 && _struct$functionalGro.isExpanded);
|
|
13150
13134
|
var rnd = this.editor.render;
|
|
13151
13135
|
var _rnd$clientArea = rnd.clientArea,
|
|
13152
13136
|
clientHeight = _rnd$clientArea.clientHeight,
|
|
@@ -13177,7 +13161,7 @@ var PasteTool = function () {
|
|
|
13177
13161
|
(_this$action = this.action) === null || _this$action === void 0 ? void 0 : _this$action.perform(this.editor.render.ctab);
|
|
13178
13162
|
}
|
|
13179
13163
|
var closestGroupItem = this.editor.findItem(event, ['functionalGroups']);
|
|
13180
|
-
var closestGroup = this.editor.struct().sgroups.get(closestGroupItem.id);
|
|
13164
|
+
var closestGroup = this.editor.struct().sgroups.get(closestGroupItem === null || closestGroupItem === void 0 ? void 0 : closestGroupItem.id);
|
|
13181
13165
|
if (!closestGroupItem || SGroup$1.isSaltOrSolvent(closestGroup === null || closestGroup === void 0 ? void 0 : closestGroup.data.name)) {
|
|
13182
13166
|
var _fromPaste3 = fromPaste(this.editor.render.ctab, this.struct, this.editor.render.page2obj(event)),
|
|
13183
13167
|
_fromPaste4 = _slicedToArray(_fromPaste3, 1),
|
|
@@ -13229,7 +13213,9 @@ var PasteTool = function () {
|
|
|
13229
13213
|
_action = _fromPaste6[0],
|
|
13230
13214
|
pasteItems = _fromPaste6[1];
|
|
13231
13215
|
this.action = _action;
|
|
13232
|
-
this.editor.update(this.action, true
|
|
13216
|
+
this.editor.update(this.action, true, {
|
|
13217
|
+
extendCanvas: false
|
|
13218
|
+
});
|
|
13233
13219
|
this.mergeItems = getMergeItems(this.editor, pasteItems);
|
|
13234
13220
|
this.editor.hover(getHoverToFuse(this.mergeItems));
|
|
13235
13221
|
}
|
|
@@ -14117,14 +14103,14 @@ var TemplateTool = function () {
|
|
|
14117
14103
|
if (sgroup) {
|
|
14118
14104
|
this.findItems.push('functionalGroups');
|
|
14119
14105
|
}
|
|
14106
|
+
editor.hoverIcon.label = tmpl.struct.name;
|
|
14107
|
+
editor.hoverIcon.fill = '#000000';
|
|
14108
|
+
editor.hoverIcon.show();
|
|
14109
|
+
editor.hoverIcon.updatePosition();
|
|
14120
14110
|
}
|
|
14121
14111
|
_createClass(TemplateTool, [{
|
|
14122
14112
|
key: "mousedown",
|
|
14123
14113
|
value: function mousedown(event) {
|
|
14124
|
-
if (this.followAction) {
|
|
14125
|
-
this.followAction.perform(this.editor.render.ctab);
|
|
14126
|
-
delete this.followAction;
|
|
14127
|
-
}
|
|
14128
14114
|
var closestItem = this.editor.findItem(event, ['atoms', 'bonds', 'sgroups', 'functionalGroups']);
|
|
14129
14115
|
var ctab = this.editor.render.ctab;
|
|
14130
14116
|
var struct = ctab.molecule;
|
|
@@ -14139,10 +14125,9 @@ var TemplateTool = function () {
|
|
|
14139
14125
|
}
|
|
14140
14126
|
}
|
|
14141
14127
|
this.editor.hover(null);
|
|
14142
|
-
var dragCtxItem = getDragCtxItem(this.editor, event, this.mode, this.mergeItems, this.findItems);
|
|
14143
14128
|
this.dragCtx = {
|
|
14144
14129
|
xy0: this.editor.render.page2obj(event),
|
|
14145
|
-
item:
|
|
14130
|
+
item: this.editor.findItem(event, this.findItems)
|
|
14146
14131
|
};
|
|
14147
14132
|
var dragCtx = this.dragCtx;
|
|
14148
14133
|
var ci = dragCtx.item;
|
|
@@ -14195,24 +14180,10 @@ var TemplateTool = function () {
|
|
|
14195
14180
|
key: "mousemove",
|
|
14196
14181
|
value: function mousemove(event) {
|
|
14197
14182
|
if (!this.dragCtx) {
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
_fromPaste2 = _slicedToArray(_fromPaste, 2),
|
|
14203
|
-
followAction = _fromPaste2[0],
|
|
14204
|
-
_pasteItems = _fromPaste2[1];
|
|
14205
|
-
this.followAction = followAction;
|
|
14206
|
-
this.editor.update(followAction, true);
|
|
14207
|
-
if (this.mode === 'fg') {
|
|
14208
|
-
var skip = getIgnoredGroupItem(this.editor.struct(), _pasteItems);
|
|
14209
|
-
var _ci = this.editor.findItem(event, this.findItems, skip);
|
|
14210
|
-
this.editor.hover(_ci !== null && _ci !== void 0 ? _ci : null, null, event);
|
|
14211
|
-
} else {
|
|
14212
|
-
this.mergeItems = getMergeItems(this.editor, _pasteItems);
|
|
14213
|
-
this.editor.hover(getHoverToFuse(this.mergeItems));
|
|
14214
|
-
}
|
|
14215
|
-
return;
|
|
14183
|
+
this.editor.hoverIcon.show();
|
|
14184
|
+
this.editor.hoverIcon.updatePosition();
|
|
14185
|
+
this.editor.hover(this.editor.findItem(event, this.findItems), null, event);
|
|
14186
|
+
return true;
|
|
14216
14187
|
}
|
|
14217
14188
|
var dragCtx = this.dragCtx;
|
|
14218
14189
|
var ci = dragCtx.item;
|
|
@@ -14233,10 +14204,10 @@ var TemplateTool = function () {
|
|
|
14233
14204
|
var _fromTemplateOnBondAc = fromTemplateOnBondAction(this.editor.render.ctab, this.template, ci.id, this.editor.event, dragCtx.sign1 * dragCtx.sign2 > 0, false),
|
|
14234
14205
|
_fromTemplateOnBondAc2 = _slicedToArray(_fromTemplateOnBondAc, 2),
|
|
14235
14206
|
_action = _fromTemplateOnBondAc2[0],
|
|
14236
|
-
|
|
14207
|
+
_pasteItems = _fromTemplateOnBondAc2[1];
|
|
14237
14208
|
dragCtx.action = _action;
|
|
14238
14209
|
this.editor.update(dragCtx.action, true);
|
|
14239
|
-
dragCtx.mergeItems = getItemsToFuse(this.editor,
|
|
14210
|
+
dragCtx.mergeItems = getItemsToFuse(this.editor, _pasteItems);
|
|
14240
14211
|
this.editor.hover(getHoverToFuse(dragCtx.mergeItems));
|
|
14241
14212
|
}
|
|
14242
14213
|
return true;
|
|
@@ -14307,7 +14278,7 @@ var TemplateTool = function () {
|
|
|
14307
14278
|
key: "mouseup",
|
|
14308
14279
|
value: function mouseup(event) {
|
|
14309
14280
|
var _this = this,
|
|
14310
|
-
|
|
14281
|
+
_ci;
|
|
14311
14282
|
var dragCtx = this.dragCtx;
|
|
14312
14283
|
if (this.targetGroupsIds.length && this.mode !== 'fg') {
|
|
14313
14284
|
this.editor.event.removeFG.dispatch({
|
|
@@ -14341,7 +14312,7 @@ var TemplateTool = function () {
|
|
|
14341
14312
|
if (this.isSaltOrSolvent) {
|
|
14342
14313
|
addSaltsAndSolventsOnCanvasWithoutMerge(restruct, this.template, dragCtx, this.editor);
|
|
14343
14314
|
return true;
|
|
14344
|
-
} else if (((
|
|
14315
|
+
} else if (((_ci = ci) === null || _ci === void 0 ? void 0 : _ci.map) === 'functionalGroups' && FunctionalGroup.isContractedFunctionalGroup(ci.id, functionalGroups) && this.mode === 'fg' && this.targetGroupsIds.length) {
|
|
14345
14316
|
functionalGroupRemoveAction = new Action();
|
|
14346
14317
|
var _struct = this.editor.struct();
|
|
14347
14318
|
var _restruct = this.editor.render.ctab;
|
|
@@ -14381,7 +14352,7 @@ var TemplateTool = function () {
|
|
|
14381
14352
|
} else {
|
|
14382
14353
|
angle = 0;
|
|
14383
14354
|
}
|
|
14384
|
-
var _fromTemplateOnAtom3 = fromTemplateOnAtom(restruct, this.template, ci.id, angle,
|
|
14355
|
+
var _fromTemplateOnAtom3 = fromTemplateOnAtom(restruct, this.template, ci.id, angle, false);
|
|
14385
14356
|
var _fromTemplateOnAtom4 = _slicedToArray(_fromTemplateOnAtom3, 2);
|
|
14386
14357
|
action = _fromTemplateOnAtom4[0];
|
|
14387
14358
|
pasteItems = _fromTemplateOnAtom4[1];
|
|
@@ -14423,10 +14394,6 @@ var TemplateTool = function () {
|
|
|
14423
14394
|
}, {
|
|
14424
14395
|
key: "cancel",
|
|
14425
14396
|
value: function cancel(e) {
|
|
14426
|
-
if (this.followAction) {
|
|
14427
|
-
this.followAction.perform(this.editor.render.ctab);
|
|
14428
|
-
delete this.followAction;
|
|
14429
|
-
}
|
|
14430
14397
|
this.mouseup(e);
|
|
14431
14398
|
}
|
|
14432
14399
|
}, {
|
|
@@ -14475,23 +14442,6 @@ function getTargetAtomId(struct, ci) {
|
|
|
14475
14442
|
return group === null || group === void 0 ? void 0 : group.getAttAtomId(struct);
|
|
14476
14443
|
}
|
|
14477
14444
|
}
|
|
14478
|
-
function getIgnoredGroupItem(struct, pasteItems) {
|
|
14479
|
-
var groupId = struct.getGroupIdFromAtomId(pasteItems.atoms[0]);
|
|
14480
|
-
return {
|
|
14481
|
-
map: 'functionalGroups',
|
|
14482
|
-
id: groupId
|
|
14483
|
-
};
|
|
14484
|
-
}
|
|
14485
|
-
function getDragCtxItem(editor, event, mode, mergeItems, findItems) {
|
|
14486
|
-
if (mode === 'fg') return editor.findItem(event, findItems);
|
|
14487
|
-
if ((mergeItems === null || mergeItems === void 0 ? void 0 : mergeItems.atoms.size) === 1 && mergeItems.bonds.size === 0) {
|
|
14488
|
-
return {
|
|
14489
|
-
map: 'atoms',
|
|
14490
|
-
id: mergeItems.atoms.values().next().value
|
|
14491
|
-
};
|
|
14492
|
-
}
|
|
14493
|
-
return null;
|
|
14494
|
-
}
|
|
14495
14445
|
|
|
14496
14446
|
var TextTool = function () {
|
|
14497
14447
|
function TextTool(editor) {
|
|
@@ -14676,7 +14626,7 @@ function handleAtomPropsDialog(_ref3) {
|
|
|
14676
14626
|
var atoms = getSelectedAtoms(selection, restruct.molecule);
|
|
14677
14627
|
var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
|
|
14678
14628
|
updateSelectedAtoms({
|
|
14679
|
-
|
|
14629
|
+
atoms: selection.atoms || [],
|
|
14680
14630
|
editor: editor,
|
|
14681
14631
|
changeAtomPromise: changeAtomPromise
|
|
14682
14632
|
});
|
|
@@ -15933,13 +15883,126 @@ function getValidInputOnly(struct, atoms, bonds) {
|
|
|
15933
15883
|
};
|
|
15934
15884
|
}
|
|
15935
15885
|
|
|
15886
|
+
var HOVER_ICON_OPACITY = 0.7;
|
|
15887
|
+
var HoverIcon = function () {
|
|
15888
|
+
function HoverIcon(editor) {
|
|
15889
|
+
_classCallCheck(this, HoverIcon);
|
|
15890
|
+
this.editor = editor;
|
|
15891
|
+
var icon = this.initialize();
|
|
15892
|
+
this.element = icon.element;
|
|
15893
|
+
this._fill = icon.fill;
|
|
15894
|
+
this._label = icon.label;
|
|
15895
|
+
this.isShown = true;
|
|
15896
|
+
this.shouldBeShownWhenMouseBack = false;
|
|
15897
|
+
this.updatePosition();
|
|
15898
|
+
var clientArea = this.editor.render.clientArea;
|
|
15899
|
+
this.onMouseMove = this.onMouseMove.bind(this);
|
|
15900
|
+
this.onMouseLeave = this.onMouseLeave.bind(this);
|
|
15901
|
+
document.addEventListener('mousemove', this.onMouseMove);
|
|
15902
|
+
clientArea.addEventListener('mouseover', this.onMouseMove);
|
|
15903
|
+
clientArea.addEventListener('mouseleave', this.onMouseLeave);
|
|
15904
|
+
}
|
|
15905
|
+
_createClass(HoverIcon, [{
|
|
15906
|
+
key: "fill",
|
|
15907
|
+
get: function get() {
|
|
15908
|
+
return this._fill;
|
|
15909
|
+
},
|
|
15910
|
+
set: function set(fillColor) {
|
|
15911
|
+
this._fill = fillColor;
|
|
15912
|
+
this.element.attr('fill', fillColor);
|
|
15913
|
+
}
|
|
15914
|
+
}, {
|
|
15915
|
+
key: "label",
|
|
15916
|
+
get: function get() {
|
|
15917
|
+
return this._label;
|
|
15918
|
+
},
|
|
15919
|
+
set: function set(label) {
|
|
15920
|
+
this._label = label;
|
|
15921
|
+
this.element.attr('text', label);
|
|
15922
|
+
}
|
|
15923
|
+
}, {
|
|
15924
|
+
key: "isOverLoader",
|
|
15925
|
+
value: function isOverLoader(event) {
|
|
15926
|
+
var target = (event === null || event === void 0 ? void 0 : event.relatedTarget) || event.target;
|
|
15927
|
+
return target === null || target === void 0 ? void 0 : target.classList.contains('loading-spinner');
|
|
15928
|
+
}
|
|
15929
|
+
}, {
|
|
15930
|
+
key: "onMouseMove",
|
|
15931
|
+
value: function onMouseMove(event) {
|
|
15932
|
+
if (this.isShown || this.isOverLoader(event) && this.shouldBeShownWhenMouseBack) {
|
|
15933
|
+
this.show();
|
|
15934
|
+
this.updatePosition();
|
|
15935
|
+
}
|
|
15936
|
+
}
|
|
15937
|
+
}, {
|
|
15938
|
+
key: "onMouseLeave",
|
|
15939
|
+
value: function onMouseLeave(event) {
|
|
15940
|
+
if (!this.isOverLoader(event)) {
|
|
15941
|
+
this.shouldBeShownWhenMouseBack = true;
|
|
15942
|
+
this.hide();
|
|
15943
|
+
}
|
|
15944
|
+
}
|
|
15945
|
+
}, {
|
|
15946
|
+
key: "updatePosition",
|
|
15947
|
+
value: function updatePosition() {
|
|
15948
|
+
var _this$editor$lastCurs = this.editor.lastCursorPosition,
|
|
15949
|
+
x = _this$editor$lastCurs.x,
|
|
15950
|
+
y = _this$editor$lastCurs.y;
|
|
15951
|
+
this.element.attr({
|
|
15952
|
+
x: x,
|
|
15953
|
+
y: y
|
|
15954
|
+
});
|
|
15955
|
+
}
|
|
15956
|
+
}, {
|
|
15957
|
+
key: "show",
|
|
15958
|
+
value: function show() {
|
|
15959
|
+
this.element.show();
|
|
15960
|
+
this.isShown = true;
|
|
15961
|
+
this.shouldBeShownWhenMouseBack = false;
|
|
15962
|
+
}
|
|
15963
|
+
}, {
|
|
15964
|
+
key: "hide",
|
|
15965
|
+
value: function hide() {
|
|
15966
|
+
this.element.hide();
|
|
15967
|
+
this.isShown = false;
|
|
15968
|
+
}
|
|
15969
|
+
}, {
|
|
15970
|
+
key: "initialize",
|
|
15971
|
+
value: function initialize() {
|
|
15972
|
+
var _this$fill;
|
|
15973
|
+
var render = this.editor.render;
|
|
15974
|
+
var fillColor = (_this$fill = this.fill) !== null && _this$fill !== void 0 ? _this$fill : '#000000';
|
|
15975
|
+
var element = render.paper.text(0, 0, this.label || '');
|
|
15976
|
+
element.attr('fill', fillColor);
|
|
15977
|
+
element.attr('font-size', this.editor.options().fontsz);
|
|
15978
|
+
element.attr('opacity', HOVER_ICON_OPACITY);
|
|
15979
|
+
return {
|
|
15980
|
+
element: element,
|
|
15981
|
+
fill: fillColor,
|
|
15982
|
+
label: (this === null || this === void 0 ? void 0 : this.label) || ''
|
|
15983
|
+
};
|
|
15984
|
+
}
|
|
15985
|
+
}, {
|
|
15986
|
+
key: "create",
|
|
15987
|
+
value: function create() {
|
|
15988
|
+
var icon = this.initialize();
|
|
15989
|
+
this.element = icon.element;
|
|
15990
|
+
this._fill = icon.fill;
|
|
15991
|
+
this._label = icon.label;
|
|
15992
|
+
this.isShown = true;
|
|
15993
|
+
this.shouldBeShownWhenMouseBack = false;
|
|
15994
|
+
this.updatePosition();
|
|
15995
|
+
}
|
|
15996
|
+
}]);
|
|
15997
|
+
return HoverIcon;
|
|
15998
|
+
}();
|
|
15999
|
+
|
|
15936
16000
|
function ownKeys$J(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15937
16001
|
function _objectSpread$J(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$J(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$J(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15938
16002
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
15939
16003
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
15940
16004
|
var SCALE = 40;
|
|
15941
16005
|
var HISTORY_SIZE = 32;
|
|
15942
|
-
var HOVER_ICON_OPACITY = 0.7;
|
|
15943
16006
|
var structObjects = ['atoms', 'bonds', 'frags', 'sgroups', 'sgroupData', 'rgroups', 'rxnArrows', 'rxnPluses', 'enhancedFlags', 'simpleObjects', 'texts'];
|
|
15944
16007
|
var highlightTargets = ['atoms', 'bonds', 'rxnArrows', 'rxnPluses', 'functionalGroups', 'frags', 'merge', 'rgroups', 'sgroups', 'sgroupData', 'enhancedFlags', 'simpleObjects', 'texts'];
|
|
15945
16008
|
function selectStereoFlagsIfNecessary(atoms, expAtoms) {
|
|
@@ -15980,7 +16043,8 @@ var Editor$3 = function () {
|
|
|
15980
16043
|
x: 0,
|
|
15981
16044
|
y: 0
|
|
15982
16045
|
};
|
|
15983
|
-
this.
|
|
16046
|
+
this.hoverIcon = new HoverIcon(this);
|
|
16047
|
+
this.hoverIcon.updatePosition();
|
|
15984
16048
|
this.contextMenu = {};
|
|
15985
16049
|
this.event = {
|
|
15986
16050
|
message: new Subscription(),
|
|
@@ -16040,26 +16104,6 @@ var Editor$3 = function () {
|
|
|
16040
16104
|
this._tool = tool;
|
|
16041
16105
|
return this._tool;
|
|
16042
16106
|
}
|
|
16043
|
-
}, {
|
|
16044
|
-
key: "updateHoverIconPosition",
|
|
16045
|
-
value: function updateHoverIconPosition() {
|
|
16046
|
-
var _this$lastCursorPosit = this.lastCursorPosition,
|
|
16047
|
-
x = _this$lastCursorPosit.x,
|
|
16048
|
-
y = _this$lastCursorPosit.y;
|
|
16049
|
-
var _this$hoverIcon$getBB = this.hoverIcon.getBBox(),
|
|
16050
|
-
height = _this$hoverIcon$getBB.height,
|
|
16051
|
-
width = _this$hoverIcon$getBB.width;
|
|
16052
|
-
this.hoverIcon.attr({
|
|
16053
|
-
x: x - width / 2,
|
|
16054
|
-
y: y - height / 2
|
|
16055
|
-
});
|
|
16056
|
-
}
|
|
16057
|
-
}, {
|
|
16058
|
-
key: "createHoverIcon",
|
|
16059
|
-
value: function createHoverIcon() {
|
|
16060
|
-
this.hoverIcon = this.render.paper.text(0, 0, '').attr('font-size', this.options().fontsz).attr('opacity', HOVER_ICON_OPACITY);
|
|
16061
|
-
this.updateHoverIconPosition();
|
|
16062
|
-
}
|
|
16063
16107
|
}, {
|
|
16064
16108
|
key: "clear",
|
|
16065
16109
|
value: function clear() {
|
|
@@ -16083,7 +16127,7 @@ var Editor$3 = function () {
|
|
|
16083
16127
|
this.selection(null);
|
|
16084
16128
|
var struct = value || new Struct();
|
|
16085
16129
|
var molecule = this.renderAndRecoordinateStruct(struct);
|
|
16086
|
-
this.
|
|
16130
|
+
this.hoverIcon.create();
|
|
16087
16131
|
return molecule;
|
|
16088
16132
|
}
|
|
16089
16133
|
}, {
|
|
@@ -16183,8 +16227,11 @@ var Editor$3 = function () {
|
|
|
16183
16227
|
}, {
|
|
16184
16228
|
key: "update",
|
|
16185
16229
|
value: function update(action, ignoreHistory) {
|
|
16230
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
16231
|
+
extendCanvas: true
|
|
16232
|
+
};
|
|
16186
16233
|
if (action === true) {
|
|
16187
|
-
this.render.update(true);
|
|
16234
|
+
this.render.update(true, null, options);
|
|
16188
16235
|
} else {
|
|
16189
16236
|
if (!ignoreHistory && !action.isDummy()) {
|
|
16190
16237
|
this.historyStack.splice(this.historyPtr, HISTORY_SIZE + 1, action);
|
|
@@ -16194,7 +16241,7 @@ var Editor$3 = function () {
|
|
|
16194
16241
|
this.historyPtr = this.historyStack.length;
|
|
16195
16242
|
this.event.change.dispatch(action);
|
|
16196
16243
|
}
|
|
16197
|
-
this.render.update();
|
|
16244
|
+
this.render.update(false, null, options);
|
|
16198
16245
|
}
|
|
16199
16246
|
}
|
|
16200
16247
|
}, {
|
|
@@ -16572,9 +16619,7 @@ var useAtomEdit = function useAtomEdit() {
|
|
|
16572
16619
|
atoms = mapAtomIdsToAtoms(atomIds, molecule);
|
|
16573
16620
|
newAtom = editor.event.elementEdit.dispatch(atoms);
|
|
16574
16621
|
updateSelectedAtoms({
|
|
16575
|
-
|
|
16576
|
-
atoms: atoms
|
|
16577
|
-
},
|
|
16622
|
+
atoms: atomIds,
|
|
16578
16623
|
changeAtomPromise: newAtom,
|
|
16579
16624
|
editor: editor
|
|
16580
16625
|
});
|
|
@@ -17138,6 +17183,9 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
|
17138
17183
|
var selection = editor.selection();
|
|
17139
17184
|
var functionalGroupsInSelection = getSelectedFunctionalGroups();
|
|
17140
17185
|
var showProps = null;
|
|
17186
|
+
if (selection && !selection.bonds && !selection.atoms) {
|
|
17187
|
+
return;
|
|
17188
|
+
}
|
|
17141
17189
|
if (selection) {
|
|
17142
17190
|
if (functionalGroupsInSelection.size > 0) {
|
|
17143
17191
|
var functionalGroups = Array.from(functionalGroupsInSelection.values());
|
|
@@ -17332,6 +17380,9 @@ function getPanelPositionRelativeToRect(clientX, clientY, sGroup, render, width,
|
|
|
17332
17380
|
var viewportLeftLimit = BAR_PANEL_SIZE * LEFT_PADDING_MULTIPLIER + width;
|
|
17333
17381
|
var viewportBottomLimit = (render === null || render === void 0 ? void 0 : (_render$clientArea = render.clientArea) === null || _render$clientArea === void 0 ? void 0 : _render$clientArea.clientHeight) - BAR_PANEL_SIZE - height;
|
|
17334
17382
|
var viewportRightLimit = (render === null || render === void 0 ? void 0 : (_render$clientArea2 = render.clientArea) === null || _render$clientArea2 === void 0 ? void 0 : _render$clientArea2.clientWidth) - BAR_PANEL_SIZE - width;
|
|
17383
|
+
if (!sGroup.hovering) {
|
|
17384
|
+
return null;
|
|
17385
|
+
}
|
|
17335
17386
|
var rectCoords = (_sGroup$hovering$attr = sGroup.hovering.attrs) === null || _sGroup$hovering$attr === void 0 ? void 0 : (_sGroup$hovering$attr2 = _sGroup$hovering$attr.path) === null || _sGroup$hovering$attr2 === void 0 ? void 0 : _sGroup$hovering$attr2.map(function (line) {
|
|
17336
17387
|
return line.slice(1);
|
|
17337
17388
|
});
|
|
@@ -17724,7 +17775,7 @@ var StructEditor = function (_Component) {
|
|
|
17724
17775
|
className: classes$D.measureLog,
|
|
17725
17776
|
ref: this.logRef
|
|
17726
17777
|
}), indigoVerification && jsx("div", {
|
|
17727
|
-
className: classes$D.spinnerOverlay,
|
|
17778
|
+
className: "".concat(classes$D.spinnerOverlay, " loading-spinner"),
|
|
17728
17779
|
children: jsx(LoadingCircles, {})
|
|
17729
17780
|
}), jsx(InfoPanel$1, {
|
|
17730
17781
|
clientX: clientX,
|
|
@@ -24004,8 +24055,8 @@ var KetcherBuilder = function () {
|
|
|
24004
24055
|
initApp(element, staticResourcesUrl, {
|
|
24005
24056
|
buttons: buttons || {},
|
|
24006
24057
|
errorHandler: errorHandler || null,
|
|
24007
|
-
version: "2.9.0-rc.
|
|
24008
|
-
buildDate: "2023-03-
|
|
24058
|
+
version: "2.9.0-rc.5" ,
|
|
24059
|
+
buildDate: "2023-03-27T12:30:17" ,
|
|
24009
24060
|
buildNumber: ''
|
|
24010
24061
|
}, structService, resolve);
|
|
24011
24062
|
});
|