ketcher-react 2.9.0-rc.3 → 2.9.0-rc.4

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
@@ -3019,7 +3019,7 @@ var templates = templates$1.reduce(function (res, struct, i) {
3019
3019
  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];
3020
3020
  var zoom = {
3021
3021
  zoom: {
3022
- shortcut: ['Ctrl+Shift+0'],
3022
+ shortcut: ['Mod+Shift+0'],
3023
3023
  selected: function selected(editor) {
3024
3024
  return editor.zoom();
3025
3025
  },
@@ -3073,7 +3073,7 @@ var zoom = {
3073
3073
 
3074
3074
  var openHelpLink = function openHelpLink() {
3075
3075
  var _window$open;
3076
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3076
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.4\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3077
3077
  };
3078
3078
  var help = {
3079
3079
  help: {
@@ -10512,8 +10512,8 @@ var AtomTool = function () {
10512
10512
  }
10513
10513
  }
10514
10514
  }, {
10515
- key: "mouseleave",
10516
- value: function mouseleave() {
10515
+ key: "mouseLeaveClientArea",
10516
+ value: function mouseLeaveClientArea() {
10517
10517
  this.editor.hoverIcon.hide();
10518
10518
  }
10519
10519
  }, {
@@ -12286,16 +12286,15 @@ function updateOnlyChangedProperties(atomId, userChangedAtom, molecule) {
12286
12286
  }, {});
12287
12287
  }
12288
12288
  function updateSelectedAtoms(_ref) {
12289
- var selection = _ref.selection,
12289
+ var atoms = _ref.atoms,
12290
12290
  changeAtomPromise = _ref.changeAtomPromise,
12291
12291
  editor = _ref.editor;
12292
12292
  var action = new ketcherCore.Action();
12293
12293
  var struct = editor.render.ctab;
12294
12294
  var molecule = struct.molecule;
12295
- if (selection !== null && selection !== void 0 && selection.atoms) {
12296
- var selectionAtoms = selection.atoms;
12295
+ if (atoms) {
12297
12296
  Promise.resolve(changeAtomPromise).then(function (userChangedAtom) {
12298
- selectionAtoms.forEach(function (atomId) {
12297
+ atoms.forEach(function (atomId) {
12299
12298
  var atomWithChangedProperties = updateOnlyChangedProperties(atomId, userChangedAtom, molecule);
12300
12299
  action.mergeWith(ketcherCore.fromAtomsAttrs(struct, atomId, atomWithChangedProperties, false));
12301
12300
  });
@@ -12627,7 +12626,7 @@ var SelectTool = function () {
12627
12626
  var atoms = getSelectedAtoms(selection, molecule);
12628
12627
  var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
12629
12628
  updateSelectedAtoms({
12630
- selection: selection,
12629
+ atoms: (selection === null || selection === void 0 ? void 0 : selection.atoms) || [],
12631
12630
  editor: editor,
12632
12631
  changeAtomPromise: changeAtomPromise
12633
12632
  });
@@ -13205,11 +13204,12 @@ function ownKeys$O(object, enumerableOnly) { var keys = Object.keys(object); if
13205
13204
  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__default["default"](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; }
13206
13205
  var PasteTool = function () {
13207
13206
  function PasteTool(editor, struct) {
13207
+ var _struct$functionalGro;
13208
13208
  _classCallCheck__default["default"](this, PasteTool);
13209
13209
  this.editor = editor;
13210
13210
  this.editor.selection(null);
13211
13211
  this.struct = struct;
13212
- this.isSingleContractedGroup = struct.isSingleGroup() && !struct.functionalGroups.get(0).isExpanded;
13212
+ this.isSingleContractedGroup = struct.isSingleGroup() && !((_struct$functionalGro = struct.functionalGroups.get(0)) !== null && _struct$functionalGro !== void 0 && _struct$functionalGro.isExpanded);
13213
13213
  var rnd = this.editor.render;
13214
13214
  var _rnd$clientArea = rnd.clientArea,
13215
13215
  clientHeight = _rnd$clientArea.clientHeight,
@@ -13240,7 +13240,7 @@ var PasteTool = function () {
13240
13240
  (_this$action = this.action) === null || _this$action === void 0 ? void 0 : _this$action.perform(this.editor.render.ctab);
13241
13241
  }
13242
13242
  var closestGroupItem = this.editor.findItem(event, ['functionalGroups']);
13243
- var closestGroup = this.editor.struct().sgroups.get(closestGroupItem.id);
13243
+ var closestGroup = this.editor.struct().sgroups.get(closestGroupItem === null || closestGroupItem === void 0 ? void 0 : closestGroupItem.id);
13244
13244
  if (!closestGroupItem || ketcherCore.SGroup.isSaltOrSolvent(closestGroup === null || closestGroup === void 0 ? void 0 : closestGroup.data.name)) {
13245
13245
  var _fromPaste3 = ketcherCore.fromPaste(this.editor.render.ctab, this.struct, this.editor.render.page2obj(event)),
13246
13246
  _fromPaste4 = _slicedToArray__default["default"](_fromPaste3, 1),
@@ -13292,7 +13292,9 @@ var PasteTool = function () {
13292
13292
  _action = _fromPaste6[0],
13293
13293
  pasteItems = _fromPaste6[1];
13294
13294
  this.action = _action;
13295
- this.editor.update(this.action, true);
13295
+ this.editor.update(this.action, true, {
13296
+ extendCanvas: false
13297
+ });
13296
13298
  this.mergeItems = getMergeItems(this.editor, pasteItems);
13297
13299
  this.editor.hover(ketcherCore.getHoverToFuse(this.mergeItems));
13298
13300
  }
@@ -14266,7 +14268,9 @@ var TemplateTool = function () {
14266
14268
  followAction = _fromPaste2[0],
14267
14269
  _pasteItems = _fromPaste2[1];
14268
14270
  this.followAction = followAction;
14269
- this.editor.update(followAction, true);
14271
+ this.editor.update(followAction, true, {
14272
+ extendCanvas: false
14273
+ });
14270
14274
  if (this.mode === 'fg') {
14271
14275
  var skip = getIgnoredGroupItem(this.editor.struct(), _pasteItems);
14272
14276
  var _ci = this.editor.findItem(event, this.findItems, skip);
@@ -14444,7 +14448,7 @@ var TemplateTool = function () {
14444
14448
  } else {
14445
14449
  angle = 0;
14446
14450
  }
14447
- var _fromTemplateOnAtom3 = ketcherCore.fromTemplateOnAtom(restruct, this.template, ci.id, angle, this.mode === 'fg');
14451
+ var _fromTemplateOnAtom3 = ketcherCore.fromTemplateOnAtom(restruct, this.template, ci.id, angle, false);
14448
14452
  var _fromTemplateOnAtom4 = _slicedToArray__default["default"](_fromTemplateOnAtom3, 2);
14449
14453
  action = _fromTemplateOnAtom4[0];
14450
14454
  pasteItems = _fromTemplateOnAtom4[1];
@@ -14739,7 +14743,7 @@ function handleAtomPropsDialog(_ref3) {
14739
14743
  var atoms = getSelectedAtoms(selection, restruct.molecule);
14740
14744
  var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
14741
14745
  updateSelectedAtoms({
14742
- selection: selection,
14746
+ atoms: selection.atoms || [],
14743
14747
  editor: editor,
14744
14748
  changeAtomPromise: changeAtomPromise
14745
14749
  });
@@ -16246,8 +16250,11 @@ var Editor$3 = function () {
16246
16250
  }, {
16247
16251
  key: "update",
16248
16252
  value: function update(action, ignoreHistory) {
16253
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
16254
+ extendCanvas: true
16255
+ };
16249
16256
  if (action === true) {
16250
- this.render.update(true);
16257
+ this.render.update(true, null, options);
16251
16258
  } else {
16252
16259
  if (!ignoreHistory && !action.isDummy()) {
16253
16260
  this.historyStack.splice(this.historyPtr, HISTORY_SIZE + 1, action);
@@ -16257,7 +16264,7 @@ var Editor$3 = function () {
16257
16264
  this.historyPtr = this.historyStack.length;
16258
16265
  this.event.change.dispatch(action);
16259
16266
  }
16260
- this.render.update();
16267
+ this.render.update(false, null, options);
16261
16268
  }
16262
16269
  }
16263
16270
  }, {
@@ -16635,9 +16642,7 @@ var useAtomEdit = function useAtomEdit() {
16635
16642
  atoms = mapAtomIdsToAtoms(atomIds, molecule);
16636
16643
  newAtom = editor.event.elementEdit.dispatch(atoms);
16637
16644
  updateSelectedAtoms({
16638
- selection: {
16639
- atoms: atoms
16640
- },
16645
+ atoms: atomIds,
16641
16646
  changeAtomPromise: newAtom,
16642
16647
  editor: editor
16643
16648
  });
@@ -17201,6 +17206,9 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
17201
17206
  var selection = editor.selection();
17202
17207
  var functionalGroupsInSelection = getSelectedFunctionalGroups();
17203
17208
  var showProps = null;
17209
+ if (selection && !selection.bonds && !selection.atoms) {
17210
+ return;
17211
+ }
17204
17212
  if (selection) {
17205
17213
  if (functionalGroupsInSelection.size > 0) {
17206
17214
  var functionalGroups = Array.from(functionalGroupsInSelection.values());
@@ -17395,6 +17403,9 @@ function getPanelPositionRelativeToRect(clientX, clientY, sGroup, render, width,
17395
17403
  var viewportLeftLimit = BAR_PANEL_SIZE * LEFT_PADDING_MULTIPLIER + width;
17396
17404
  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;
17397
17405
  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;
17406
+ if (!sGroup.hovering) {
17407
+ return null;
17408
+ }
17398
17409
  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) {
17399
17410
  return line.slice(1);
17400
17411
  });
@@ -24067,8 +24078,8 @@ var KetcherBuilder = function () {
24067
24078
  initApp(element, staticResourcesUrl, {
24068
24079
  buttons: buttons || {},
24069
24080
  errorHandler: errorHandler || null,
24070
- version: "2.9.0-rc.3" ,
24071
- buildDate: "2023-03-11T13:55:42" ,
24081
+ version: "2.9.0-rc.4" ,
24082
+ buildDate: "2023-03-20T17:32:42" ,
24072
24083
  buildNumber: ''
24073
24084
  }, structService, resolve);
24074
24085
  });