ketcher-react 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.
@@ -7533,8 +7533,8 @@ var useLibraryItemDrag = function useLibraryItemDrag(item, itemRef) {
7533
7533
  right = canvasWrapperBoundingClientRect.right,
7534
7534
  bottom = canvasWrapperBoundingClientRect.bottom;
7535
7535
  var transform = ketcherCore.ZoomTool.instance.zoomTransform;
7536
- var adjustedX = x - left + 15;
7537
- var adjustedY = y - top + 15;
7536
+ var adjustedX = x - left + transform.k * 15;
7537
+ var adjustedY = y - top + transform.k * 15;
7538
7538
  var _transform$invert = transform.invert([adjustedX, adjustedY]),
7539
7539
  _transform$invert2 = _slicedToArray__default["default"](_transform$invert, 2),
7540
7540
  scaledX = _transform$invert2[0],
@@ -12922,9 +12922,9 @@ function useLoading() {
12922
12922
 
12923
12923
  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; }
12924
12924
  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; }
12925
- 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; } } }; }
12926
- 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); }
12927
- 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; }
12925
+ 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; } } }; }
12926
+ 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; } }
12927
+ 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; }
12928
12928
  function useSetRnaPresets() {
12929
12929
  var dispatch = useAppDispatch();
12930
12930
  var editor = useAppSelector(selectEditor);
@@ -13434,9 +13434,9 @@ var LayoutModeButton = function LayoutModeButton() {
13434
13434
  });
13435
13435
  };
13436
13436
 
13437
- 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; } } }; }
13438
- 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); }
13439
- 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; }
13437
+ 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; } } }; }
13438
+ 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; } }
13439
+ 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; }
13440
13440
  var generateLabeledNodes = function generateLabeledNodes(selectionsFlatten) {
13441
13441
  var labeledNodes = [];
13442
13442
  var _iterator = _createForOfIteratorHelper$1(selectionsFlatten),
@@ -14899,9 +14899,9 @@ var useRecalculateMacromoleculeProperties = function useRecalculateMacromolecule
14899
14899
  };
14900
14900
 
14901
14901
  var _excluded = ["className"];
14902
- 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; } } }; }
14903
- 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); }
14904
- 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; }
14902
+ 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; } } }; }
14903
+ 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; } }
14904
+ 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; }
14905
14905
  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; }
14906
14906
  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; }
14907
14907
  var OTHER_MONOMER_COUNT_NAME = 'Other';
@@ -17293,8 +17293,7 @@ var RulerArea = function RulerArea() {
17293
17293
  var styles = {"dragGhost":"DragGhost-module_dragGhost__m5lHf"};
17294
17294
 
17295
17295
  var GhostRnaPreset = function GhostRnaPreset(_ref) {
17296
- var preset = _ref.preset,
17297
- zoomFactor = _ref.zoomFactor;
17296
+ var preset = _ref.preset;
17298
17297
  var sugar = preset.sugar,
17299
17298
  phosphate = preset.phosphate,
17300
17299
  base = preset.base;
@@ -17326,9 +17325,8 @@ var GhostRnaPreset = function GhostRnaPreset(_ref) {
17326
17325
  var sugarSize = sugarRenderer.monomerSize;
17327
17326
  var phosphateSize = phosphateRenderer === null || phosphateRenderer === void 0 ? void 0 : phosphateRenderer.monomerSize;
17328
17327
  var baseSize = baseRenderer === null || baseRenderer === void 0 ? void 0 : baseRenderer.monomerSize;
17329
- var scaledOffset = (zoomFactor - 1) * 30;
17330
- var sugarX = scaledOffset;
17331
- var sugarY = scaledOffset;
17328
+ var sugarX = 0;
17329
+ var sugarY = 0;
17332
17330
  var phosphateX = phosphateSize ? sugarX + sugarSize.width + 30 : 0;
17333
17331
  var phosphateY = sugarY;
17334
17332
  var baseX = sugarX + (sugarSize.width - ((baseSize === null || baseSize === void 0 ? void 0 : baseSize.width) || 0)) / 2;
@@ -17496,7 +17494,16 @@ var DragGhost = function DragGhost() {
17496
17494
  return;
17497
17495
  }
17498
17496
  animateRef.current = requestAnimationFrame(function () {
17499
- element.style.transform = "translate(".concat(libraryItemDragData.position.x, "px, ").concat(libraryItemDragData.position.y, "px) scale(").concat(dragOverCanvas ? transform.k : 1, ")");
17497
+ var _libraryItemDragData$ = libraryItemDragData.position,
17498
+ x = _libraryItemDragData$.x,
17499
+ y = _libraryItemDragData$.y;
17500
+ if (dragOverCanvas && canvasBBoxRef.current) {
17501
+ var scale = transform.k;
17502
+ element.style.transformOrigin = '0 0';
17503
+ element.style.transform = "translate(".concat(x, "px, ").concat(y, "px) scale(").concat(scale, ")");
17504
+ } else {
17505
+ element.style.transform = "translate(".concat(x, "px, ").concat(y, "px)");
17506
+ }
17500
17507
  });
17501
17508
  return function () {
17502
17509
  if (animateRef.current) {
@@ -17512,8 +17519,7 @@ var DragGhost = function DragGhost() {
17512
17519
  className: styles.dragGhost,
17513
17520
  ref: ghostWrapperRef,
17514
17521
  children: ketcherCore.isLibraryItemRnaPreset(libraryItemDragData.item) ? jsxRuntime.jsx(GhostRnaPreset, {
17515
- preset: libraryItemDragData.item,
17516
- zoomFactor: transform.k
17522
+ preset: libraryItemDragData.item
17517
17523
  }) : jsxRuntime.jsx(GhostMonomer, {
17518
17524
  monomerItem: libraryItemDragData.item
17519
17525
  })
@@ -17781,4 +17787,4 @@ function Editor(_ref2) {
17781
17787
  }
17782
17788
 
17783
17789
  exports["default"] = EditorContainer;
17784
- //# sourceMappingURL=index.modern-4c4698fb.js.map
17790
+ //# sourceMappingURL=index.modern-44fde8a2.js.map