ketcher-react 3.1.0-rc.6 → 3.2.0-rc.1

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.
@@ -77,10 +77,10 @@ declare class Editor implements KetcherEditor {
77
77
  setOrigin(): void;
78
78
  tool(name?: any, opts?: any): Tool | null;
79
79
  clear(): void;
80
- renderAndRecoordinateStruct(struct: Struct, needToCenterStruct?: boolean): Struct;
80
+ renderAndRecoordinateStruct(struct: Struct, needToCenterStruct?: boolean, x?: number, y?: number): Struct;
81
81
  /** Apply {@link value}: {@link Struct} if provided to {@link render} and */
82
- struct(value?: Struct, needToCenterStruct?: boolean): Struct;
83
- structToAddFragment(value: Struct): Struct;
82
+ struct(value?: Struct, needToCenterStruct?: boolean, x?: number, y?: number): Struct;
83
+ structToAddFragment(value: Struct, x?: number, y?: number): Struct;
84
84
  setOptions(opts: string): false | import("ketcher-core").RenderOptions;
85
85
  /** Apply options from {@link value} */
86
86
  options(value?: any): import("ketcher-core").RenderOptions;
@@ -88,6 +88,7 @@ declare class Editor implements KetcherEditor {
88
88
  private updateToolAfterOptionsChange;
89
89
  zoom(value?: any, event?: WheelEvent): number;
90
90
  centerStruct(): void;
91
+ positionStruct(x: number, y: number): void;
91
92
  zoomAccordingContent(struct: Struct): void;
92
93
  selection(ci?: any): Selection | null;
93
94
  hover(ci: {
package/dist/index.js CHANGED
@@ -3743,7 +3743,7 @@ var zoom = {
3743
3743
 
3744
3744
  var openHelpLink = function openHelpLink() {
3745
3745
  var _window$open;
3746
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.1.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3746
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.2.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3747
3747
  };
3748
3748
  var help = {
3749
3749
  help: {
@@ -24553,10 +24553,14 @@ var Editor$3 = function () {
24553
24553
  key: "renderAndRecoordinateStruct",
24554
24554
  value: function renderAndRecoordinateStruct(struct) {
24555
24555
  var needToCenterStruct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
24556
+ var x = arguments.length > 2 ? arguments[2] : undefined;
24557
+ var y = arguments.length > 3 ? arguments[3] : undefined;
24556
24558
  var action = fromNewCanvas(this.render.ctab, struct);
24557
24559
  this.update(action);
24558
24560
  if (needToCenterStruct) {
24559
24561
  this.centerStruct();
24562
+ } else if (x != null && y != null) {
24563
+ this.positionStruct(x, y);
24560
24564
  }
24561
24565
  return this.render.ctab.molecule;
24562
24566
  }
@@ -24564,22 +24568,33 @@ var Editor$3 = function () {
24564
24568
  key: "struct",
24565
24569
  value: function struct(value) {
24566
24570
  var needToCenterStruct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
24571
+ var x = arguments.length > 2 ? arguments[2] : undefined;
24572
+ var y = arguments.length > 3 ? arguments[3] : undefined;
24567
24573
  if (arguments.length === 0) {
24568
24574
  return this.render.ctab.molecule;
24569
24575
  }
24570
24576
  KetcherLogger.log('Editor.struct(), start', value, needToCenterStruct);
24571
24577
  this.selection(null);
24572
24578
  var struct = value || new Struct();
24573
- var molecule = this.renderAndRecoordinateStruct(struct, needToCenterStruct);
24579
+ var molecule = this.renderAndRecoordinateStruct(struct, needToCenterStruct, x, y);
24574
24580
  this.hoverIcon.create();
24575
24581
  KetcherLogger.log('Editor.struct(), end');
24576
24582
  return molecule;
24577
24583
  }
24578
24584
  }, {
24579
24585
  key: "structToAddFragment",
24580
- value: function structToAddFragment(value) {
24581
- var superStruct = value.mergeInto(this.render.ctab.molecule.clone());
24582
- return this.renderAndRecoordinateStruct(superStruct);
24586
+ value: function structToAddFragment(value, x, y) {
24587
+ if (x != null && y != null) {
24588
+ var position = new Vec2(x, y);
24589
+ var _fromPaste = fromPaste(this.render.ctab, value, position, 0),
24590
+ _fromPaste2 = _slicedToArray$1(_fromPaste, 1),
24591
+ action = _fromPaste2[0];
24592
+ this.update(action, true);
24593
+ return this.render.ctab.molecule;
24594
+ } else {
24595
+ var superStruct = value.mergeInto(this.render.ctab.molecule.clone());
24596
+ return this.renderAndRecoordinateStruct(superStruct);
24597
+ }
24583
24598
  }
24584
24599
  }, {
24585
24600
  key: "setOptions",
@@ -24649,6 +24664,17 @@ var Editor$3 = function () {
24649
24664
  var action = fromMultipleMove(structure, structureToMove, shiftVector);
24650
24665
  this.update(action, true);
24651
24666
  }
24667
+ }, {
24668
+ key: "positionStruct",
24669
+ value: function positionStruct(x, y) {
24670
+ var structure = this.render.ctab;
24671
+ var structCenter = getStructCenter(structure);
24672
+ var viewBoxCenter = new Vec2(this.render.viewBox.minX + x, this.render.viewBox.minY + y);
24673
+ var shiftVector = viewBoxCenter.sub(structCenter);
24674
+ var structureToMove = getSelectionMap(structure);
24675
+ var action = fromMultipleMove(structure, structureToMove, shiftVector);
24676
+ this.update(action, true);
24677
+ }
24652
24678
  }, {
24653
24679
  key: "zoomAccordingContent",
24654
24680
  value: function zoomAccordingContent(struct) {
@@ -35019,8 +35045,8 @@ var KetcherBuilder = function () {
35019
35045
  cleanup = initApp(element, appRoot, staticResourcesUrl, {
35020
35046
  buttons: buttons || {},
35021
35047
  errorHandler: errorHandler || null,
35022
- version: "3.1.0-rc.6" ,
35023
- buildDate: "2025-02-26T20:07:36" ,
35048
+ version: "3.2.0-rc.1" ,
35049
+ buildDate: "2025-03-04T14:36:10" ,
35024
35050
  buildNumber: '',
35025
35051
  customButtons: customButtons || []
35026
35052
  }, structService, resolve, togglerComponent);
@@ -35312,7 +35338,7 @@ var ModeControl = function ModeControl(_ref3) {
35312
35338
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35313
35339
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
35314
35340
  var MacromoleculesEditor = lazy(function () {
35315
- return import('./index.modern-1eba1f75.js');
35341
+ return import('./index.modern-17b0bd64.js');
35316
35342
  });
35317
35343
  var Editor = function Editor(props) {
35318
35344
  var _useState = useState(false),