libpetri 1.8.4 → 1.8.5
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,5 +1,11 @@
|
|
|
1
1
|
// Petri Net Diagram Viewer
|
|
2
|
-
// Provides: zoom/pan and fullscreen for pre-rendered SVG diagrams
|
|
2
|
+
// Provides: zoom/pan and fullscreen for pre-rendered SVG diagrams.
|
|
3
|
+
//
|
|
4
|
+
// IMPORTANT: this file is mirrored at:
|
|
5
|
+
// - java/src/main/resources/javadoc/petrinet-diagrams.js
|
|
6
|
+
// - typescript/src/doclet/resources/petrinet-diagrams.js
|
|
7
|
+
// Keep both copies byte-identical until they're unified into one source.
|
|
8
|
+
// Same applies to the sibling petrinet-diagrams.css.
|
|
3
9
|
|
|
4
10
|
(function() {
|
|
5
11
|
if (document.readyState === 'loading') {
|
|
@@ -42,7 +48,9 @@ function enhanceDiagrams() {
|
|
|
42
48
|
if (!e.ctrlKey) return;
|
|
43
49
|
e.preventDefault();
|
|
44
50
|
var delta = e.deltaY > 0 ? 0.9 : 1.1;
|
|
45
|
-
|
|
51
|
+
// Bounds match libpetri/render-dom (debug-ui, dev-preview) so doc and
|
|
52
|
+
// live diagrams zoom to the same depth.
|
|
53
|
+
var newScale = Math.max(0.02, Math.min(1000, scale * delta));
|
|
46
54
|
var rect = container.getBoundingClientRect();
|
|
47
55
|
var mouseX = e.clientX - rect.left - rect.width / 2;
|
|
48
56
|
var mouseY = e.clientY - rect.top - rect.height / 2;
|