ketcher-macromolecules 3.6.0-rc.1 → 3.6.0

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.
@@ -1,7 +1,6 @@
1
1
  import { IRnaPreset } from 'ketcher-core';
2
2
  declare type Props = {
3
3
  preset: IRnaPreset;
4
- zoomFactor: number;
5
4
  };
6
- export declare const GhostRnaPreset: ({ preset, zoomFactor }: Props) => import("@emotion/react/jsx-runtime").JSX.Element | null;
5
+ export declare const GhostRnaPreset: ({ preset }: Props) => import("@emotion/react/jsx-runtime").JSX.Element | null;
7
6
  export {};
package/dist/index.js CHANGED
@@ -2364,8 +2364,8 @@ var useLibraryItemDrag = function useLibraryItemDrag(item, itemRef) {
2364
2364
  right = canvasWrapperBoundingClientRect.right,
2365
2365
  bottom = canvasWrapperBoundingClientRect.bottom;
2366
2366
  var transform = ketcherCore.ZoomTool.instance.zoomTransform;
2367
- var adjustedX = x - left + 15;
2368
- var adjustedY = y - top + 15;
2367
+ var adjustedX = x - left + transform.k * 15;
2368
+ var adjustedY = y - top + transform.k * 15;
2369
2369
  var _transform$invert = transform.invert([adjustedX, adjustedY]),
2370
2370
  _transform$invert2 = _slicedToArray__default["default"](_transform$invert, 2),
2371
2371
  scaledX = _transform$invert2[0],
@@ -7753,9 +7753,9 @@ function useLoading() {
7753
7753
 
7754
7754
  function ownKeys$3(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; }
7755
7755
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7756
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7757
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
7758
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7756
+ function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
7757
+ function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
7758
+ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7759
7759
  function useSetRnaPresets() {
7760
7760
  var dispatch = useAppDispatch();
7761
7761
  var editor = useAppSelector(selectEditor);
@@ -8265,9 +8265,9 @@ var LayoutModeButton = function LayoutModeButton() {
8265
8265
  });
8266
8266
  };
8267
8267
 
8268
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
8269
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
8270
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8268
+ function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8269
+ function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
8270
+ function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8271
8271
  var generateLabeledNodes = function generateLabeledNodes(selectionsFlatten) {
8272
8272
  var labeledNodes = [];
8273
8273
  var _iterator = _createForOfIteratorHelper$1(selectionsFlatten),
@@ -9730,9 +9730,9 @@ var useRecalculateMacromoleculeProperties = function useRecalculateMacromolecule
9730
9730
  };
9731
9731
 
9732
9732
  var _excluded = ["className"];
9733
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
9734
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9735
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9733
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9734
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9735
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9736
9736
  function ownKeys$1(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; }
9737
9737
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9738
9738
  var OTHER_MONOMER_COUNT_NAME = 'Other';
@@ -12124,8 +12124,7 @@ var RulerArea = function RulerArea() {
12124
12124
  var styles = {"dragGhost":"DragGhost-module_dragGhost__m5lHf"};
12125
12125
 
12126
12126
  var GhostRnaPreset = function GhostRnaPreset(_ref) {
12127
- var preset = _ref.preset,
12128
- zoomFactor = _ref.zoomFactor;
12127
+ var preset = _ref.preset;
12129
12128
  var sugar = preset.sugar,
12130
12129
  phosphate = preset.phosphate,
12131
12130
  base = preset.base;
@@ -12157,9 +12156,8 @@ var GhostRnaPreset = function GhostRnaPreset(_ref) {
12157
12156
  var sugarSize = sugarRenderer.monomerSize;
12158
12157
  var phosphateSize = phosphateRenderer === null || phosphateRenderer === void 0 ? void 0 : phosphateRenderer.monomerSize;
12159
12158
  var baseSize = baseRenderer === null || baseRenderer === void 0 ? void 0 : baseRenderer.monomerSize;
12160
- var scaledOffset = (zoomFactor - 1) * 30;
12161
- var sugarX = scaledOffset;
12162
- var sugarY = scaledOffset;
12159
+ var sugarX = 0;
12160
+ var sugarY = 0;
12163
12161
  var phosphateX = phosphateSize ? sugarX + sugarSize.width + 30 : 0;
12164
12162
  var phosphateY = sugarY;
12165
12163
  var baseX = sugarX + (sugarSize.width - ((baseSize === null || baseSize === void 0 ? void 0 : baseSize.width) || 0)) / 2;
@@ -12327,7 +12325,16 @@ var DragGhost = function DragGhost() {
12327
12325
  return;
12328
12326
  }
12329
12327
  animateRef.current = requestAnimationFrame(function () {
12330
- element.style.transform = "translate(".concat(libraryItemDragData.position.x, "px, ").concat(libraryItemDragData.position.y, "px) scale(").concat(dragOverCanvas ? transform.k : 1, ")");
12328
+ var _libraryItemDragData$ = libraryItemDragData.position,
12329
+ x = _libraryItemDragData$.x,
12330
+ y = _libraryItemDragData$.y;
12331
+ if (dragOverCanvas && canvasBBoxRef.current) {
12332
+ var scale = transform.k;
12333
+ element.style.transformOrigin = '0 0';
12334
+ element.style.transform = "translate(".concat(x, "px, ").concat(y, "px) scale(").concat(scale, ")");
12335
+ } else {
12336
+ element.style.transform = "translate(".concat(x, "px, ").concat(y, "px)");
12337
+ }
12331
12338
  });
12332
12339
  return function () {
12333
12340
  if (animateRef.current) {
@@ -12343,8 +12350,7 @@ var DragGhost = function DragGhost() {
12343
12350
  className: styles.dragGhost,
12344
12351
  ref: ghostWrapperRef,
12345
12352
  children: ketcherCore.isLibraryItemRnaPreset(libraryItemDragData.item) ? jsxRuntime.jsx(GhostRnaPreset, {
12346
- preset: libraryItemDragData.item,
12347
- zoomFactor: transform.k
12353
+ preset: libraryItemDragData.item
12348
12354
  }) : jsxRuntime.jsx(GhostMonomer, {
12349
12355
  monomerItem: libraryItemDragData.item
12350
12356
  })