openchemlib 9.1.0 → 9.1.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.
- package/dist/openchemlib.debug.js +26 -12
- package/dist/openchemlib.js +9 -9
- package/package.json +1 -1
|
@@ -46,6 +46,7 @@ function decodeBase64(base64) {
|
|
|
46
46
|
function toHex(v) {
|
|
47
47
|
return v.toString(16).padStart(2, "0");
|
|
48
48
|
}
|
|
49
|
+
var hidpiScaleFactor = globalThis.devicePixelRatio || 1;
|
|
49
50
|
|
|
50
51
|
// lib/canvas_editor/draw_context.js
|
|
51
52
|
var DrawContext = class {
|
|
@@ -229,8 +230,8 @@ function addPointerListeners(canvasElement, drawArea, JavaEditorArea) {
|
|
|
229
230
|
what,
|
|
230
231
|
ev.button + 1,
|
|
231
232
|
clickCount,
|
|
232
|
-
Math.round(ev.offsetX),
|
|
233
|
-
Math.round(ev.offsetY),
|
|
233
|
+
Math.round(ev.offsetX * hidpiScaleFactor),
|
|
234
|
+
Math.round(ev.offsetY * hidpiScaleFactor),
|
|
234
235
|
ev.shiftKey,
|
|
235
236
|
ev.ctrlKey,
|
|
236
237
|
ev.altKey,
|
|
@@ -334,7 +335,9 @@ var Toolbar = class {
|
|
|
334
335
|
}
|
|
335
336
|
setDimensions(width, height) {
|
|
336
337
|
this.canvasElement.width = width;
|
|
338
|
+
this.canvasElement.style.width = `${width / hidpiScaleFactor}px`;
|
|
337
339
|
this.canvasElement.height = height;
|
|
340
|
+
this.canvasElement.style.height = `${height / hidpiScaleFactor}px`;
|
|
338
341
|
}
|
|
339
342
|
getDrawContext() {
|
|
340
343
|
return this.drawContext;
|
|
@@ -762,14 +765,17 @@ function createEditor(parentElement, options, onChange, JavaEditorArea, JavaEdit
|
|
|
762
765
|
}
|
|
763
766
|
uiHelper.setEditorArea(editorArea);
|
|
764
767
|
const toolbar = readOnly ? null : new JavaEditorToolbar(editorArea, new Toolbar(toolbarCanvas), uiHelper);
|
|
768
|
+
function updateCanvasDimensions(containerSize2) {
|
|
769
|
+
editorCanvas.style.width = `${containerSize2.width}px`;
|
|
770
|
+
editorCanvas.width = Math.floor(containerSize2.width * hidpiScaleFactor);
|
|
771
|
+
editorCanvas.style.height = `${containerSize2.height}px`;
|
|
772
|
+
editorCanvas.height = Math.floor(containerSize2.height * hidpiScaleFactor);
|
|
773
|
+
editorArea.repaint();
|
|
774
|
+
}
|
|
765
775
|
const containerSize = editorContainer.getBoundingClientRect();
|
|
766
|
-
|
|
767
|
-
editorCanvas.height = containerSize.height;
|
|
768
|
-
editorArea.repaint();
|
|
776
|
+
updateCanvasDimensions(containerSize);
|
|
769
777
|
const resizeObserver = new ResizeObserver(([entry]) => {
|
|
770
|
-
|
|
771
|
-
editorCanvas.height = entry.contentRect.height;
|
|
772
|
-
editorArea.repaint();
|
|
778
|
+
updateCanvasDimensions(entry.contentRect);
|
|
773
779
|
});
|
|
774
780
|
resizeObserver.observe(editorContainer);
|
|
775
781
|
let removePointerListeners = null;
|
|
@@ -46622,6 +46628,7 @@ function getExports($wnd) {
|
|
|
46622
46628
|
cargh.$clinit_HiDPIHelper = function $clinit_HiDPIHelper() {
|
|
46623
46629
|
cargh.$clinit_HiDPIHelper = emptyMethod;
|
|
46624
46630
|
jl.$clinit_Object();
|
|
46631
|
+
cargh.sUIScaleFactor = -1;
|
|
46625
46632
|
};
|
|
46626
46633
|
cargh.disableImage = function disableImage(image) {
|
|
46627
46634
|
cargh.$clinit_HiDPIHelper();
|
|
@@ -46635,15 +46642,22 @@ function getExports($wnd) {
|
|
|
46635
46642
|
}
|
|
46636
46643
|
}
|
|
46637
46644
|
};
|
|
46645
|
+
cargh.getDevicePixelRatio = function getDevicePixelRatio() {
|
|
46646
|
+
return globalThis.devicePixelRatio || 1;
|
|
46647
|
+
};
|
|
46638
46648
|
cargh.getUIScaleFactor = function getUIScaleFactor() {
|
|
46639
46649
|
cargh.$clinit_HiDPIHelper();
|
|
46640
|
-
|
|
46650
|
+
if (cargh.sUIScaleFactor == -1) {
|
|
46651
|
+
cargh.sUIScaleFactor = cargh.getDevicePixelRatio();
|
|
46652
|
+
}
|
|
46653
|
+
return cargh.sUIScaleFactor;
|
|
46641
46654
|
};
|
|
46642
46655
|
cargh.scale_3 = function scale_3(value_0) {
|
|
46643
46656
|
cargh.$clinit_HiDPIHelper();
|
|
46644
46657
|
return jl.round_2(cargh.getUIScaleFactor() * value_0);
|
|
46645
46658
|
};
|
|
46646
46659
|
defineClass(740, 1, { 1: 1 });
|
|
46660
|
+
cargh.sUIScaleFactor = 0;
|
|
46647
46661
|
cggl.Lcom_actelion_research_gui_hidpi_HiDPIHelper_2_classLit = createForClass("com.actelion.research.gui.hidpi", "HiDPIHelper", 740, cggl.Ljava_lang_Object_2_classLit);
|
|
46648
46662
|
cargh.$clinit_HiDPIIcon = function $clinit_HiDPIIcon() {
|
|
46649
46663
|
cargh.$clinit_HiDPIIcon = emptyMethod;
|
|
@@ -69784,7 +69798,7 @@ function getExports($wnd) {
|
|
|
69784
69798
|
$sendStats("moduleStartup", "end");
|
|
69785
69799
|
$gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
|
|
69786
69800
|
const toReturn = $wnd["OCL"];
|
|
69787
|
-
toReturn.version = "9.1.
|
|
69801
|
+
toReturn.version = "9.1.1";
|
|
69788
69802
|
return toReturn;
|
|
69789
69803
|
}
|
|
69790
69804
|
var isBrowserWindow = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -69926,8 +69940,8 @@ export {
|
|
|
69926
69940
|
};
|
|
69927
69941
|
/**
|
|
69928
69942
|
* openchemlib - Manipulate molecules
|
|
69929
|
-
* @version v9.1.
|
|
69930
|
-
* @date 2025-
|
|
69943
|
+
* @version v9.1.1
|
|
69944
|
+
* @date 2025-05-01T15:21:26.910Z
|
|
69931
69945
|
* @link https://github.com/cheminfo/openchemlib-js
|
|
69932
69946
|
* @license BSD-3-Clause
|
|
69933
69947
|
*/
|