pyegeria 5.3.4.4.dev3__py3-none-any.whl → 5.3.4.4.dev5__py3-none-any.whl
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.
- pyegeria/mermaid_utilities.py +108 -24
- {pyegeria-5.3.4.4.dev3.dist-info → pyegeria-5.3.4.4.dev5.dist-info}/METADATA +1 -1
- {pyegeria-5.3.4.4.dev3.dist-info → pyegeria-5.3.4.4.dev5.dist-info}/RECORD +6 -6
- {pyegeria-5.3.4.4.dev3.dist-info → pyegeria-5.3.4.4.dev5.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.4.4.dev3.dist-info → pyegeria-5.3.4.4.dev5.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.4.4.dev3.dist-info → pyegeria-5.3.4.4.dev5.dist-info}/entry_points.txt +0 -0
pyegeria/mermaid_utilities.py
CHANGED
@@ -235,42 +235,126 @@ def construct_mermaid_html(mermaid_str: str) -> str:
|
|
235
235
|
# Construct the HTML content with Mermaid.js initialization and zoom/pan support
|
236
236
|
mermaid_html = f"""
|
237
237
|
<!DOCTYPE html>
|
238
|
-
<html>
|
238
|
+
<html lang="en">
|
239
239
|
<head>
|
240
|
-
<
|
240
|
+
<meta charset="UTF-8">
|
241
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
242
|
+
<title>Interactive Mermaid Graph</title>
|
243
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
241
244
|
<script>
|
242
|
-
// Initialize
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
245
|
+
// Initialize Mermaid.js
|
246
|
+
document.addEventListener("DOMContentLoaded", function() {{
|
247
|
+
const graphContainer = document.getElementById("{graph_id}");
|
248
|
+
|
249
|
+
// Inject Mermaid code into the container
|
250
|
+
graphContainer.innerHTML = `{mermaid_code}`;
|
251
|
+
|
252
|
+
// Manually render the Mermaid graph
|
253
|
+
window.mermaid?.run({{ querySelector: "#{graph_id}" }});
|
254
|
+
}});
|
255
|
+
|
256
|
+
// Enable panning and zooming
|
257
|
+
document.addEventListener("DOMContentLoaded", function() {{
|
258
|
+
const container = document.querySelector('.pan-zoom-container');
|
259
|
+
const content = document.querySelector('.pan-zoom-content');
|
260
|
+
|
261
|
+
let scale = 1;
|
262
|
+
let panX = 0;
|
263
|
+
let panY = 0;
|
264
|
+
let isDragging = false;
|
265
|
+
let startX, startY;
|
266
|
+
|
267
|
+
// Mouse wheel zoom with cursor as focal point
|
268
|
+
container.addEventListener('wheel', function(event) {{
|
269
|
+
event.preventDefault();
|
270
|
+
const zoomSpeed = 0.1;
|
271
|
+
const zoomDelta = event.deltaY > 0 ? -zoomSpeed : zoomSpeed;
|
272
|
+
const previousScale = scale;
|
273
|
+
|
274
|
+
// Clamp zoom level between 50% and 400%
|
275
|
+
scale = Math.min(Math.max(0.5, scale + zoomDelta), 4);
|
276
|
+
|
277
|
+
// Calculate the focal point for zoom using mouse position
|
278
|
+
const rect = content.getBoundingClientRect();
|
279
|
+
const offsetX = event.clientX - rect.left;
|
280
|
+
const offsetY = event.clientY - rect.top;
|
281
|
+
|
282
|
+
// Adjust pan values to focus zoom on cursor
|
283
|
+
panX -= (offsetX / previousScale - offsetX / scale);
|
284
|
+
panY -= (offsetY / previousScale - offsetY / scale);
|
285
|
+
|
286
|
+
// Apply transformations
|
287
|
+
content.style.transform = `translate(${panX}px, ${panY}px) scale(${scale})`;
|
288
|
+
}});
|
289
|
+
|
290
|
+
// Handle panning with mouse drag
|
291
|
+
container.addEventListener('mousedown', function(event) {{
|
292
|
+
isDragging = true;
|
293
|
+
startX = event.clientX - panX;
|
294
|
+
startY = event.clientY - panY;
|
295
|
+
container.style.cursor = "grabbing";
|
296
|
+
}});
|
297
|
+
|
298
|
+
container.addEventListener('mousemove', function(event) {{
|
299
|
+
if (!isDragging) return;
|
300
|
+
panX = event.clientX - startX;
|
301
|
+
panY = event.clientY - startY;
|
302
|
+
|
303
|
+
// Apply transformations
|
304
|
+
content.style.transform = `translate(${panX}px, ${panY}px) scale(${scale})`;
|
305
|
+
}});
|
306
|
+
|
307
|
+
container.addEventListener('mouseup', function() {{
|
308
|
+
isDragging = false;
|
309
|
+
container.style.cursor = "grab";
|
310
|
+
}});
|
311
|
+
|
312
|
+
container.addEventListener('mouseleave', function() {{
|
313
|
+
isDragging = false;
|
314
|
+
container.style.cursor = "grab";
|
315
|
+
}});
|
259
316
|
}});
|
260
317
|
</script>
|
318
|
+
<style>
|
319
|
+
body {{
|
320
|
+
margin: 0;
|
321
|
+
padding: 0;
|
322
|
+
font-family: Arial, sans-serif;
|
323
|
+
}}
|
324
|
+
.pan-zoom-container {{
|
325
|
+
overflow: hidden;
|
326
|
+
position: relative;
|
327
|
+
width: 100%;
|
328
|
+
height: 100vh;
|
329
|
+
background-color: #f4f4f4;
|
330
|
+
}}
|
331
|
+
.pan-zoom-content {{
|
332
|
+
display: inline-block;
|
333
|
+
transform-origin: 0 0;
|
334
|
+
cursor: grab;
|
335
|
+
}}
|
336
|
+
.pan-zoom-content:active {{
|
337
|
+
cursor: grabbing;
|
338
|
+
}}
|
339
|
+
</style>
|
261
340
|
</head>
|
262
341
|
<body>
|
263
|
-
<
|
264
|
-
<
|
265
|
-
|
266
|
-
|
267
|
-
|
342
|
+
<title>{title_label}</title>
|
343
|
+
<h3>{title_label}</h3>
|
344
|
+
GUID : {guid}
|
345
|
+
<div class="pan-zoom-container">
|
346
|
+
<div id="{graph_id}" class="pan-zoom-content mermaid">
|
347
|
+
<!-- Placeholder for Mermaid.js -->
|
348
|
+
</div>
|
349
|
+
</div>
|
268
350
|
</body>
|
269
351
|
</html>
|
270
352
|
"""
|
271
353
|
|
272
354
|
return mermaid_html
|
273
355
|
|
356
|
+
|
357
|
+
|
274
358
|
def save_mermaid_html(
|
275
359
|
title: str, mermaid_str: str, folder: str = EGERIA_MERMAID_FOLDER
|
276
360
|
):
|
@@ -502,7 +502,7 @@ pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3eu
|
|
502
502
|
pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
|
503
503
|
pyegeria/glossary_browser_omvs.py,sha256=RCvZ1l2xg6uZ1o4xGJUkIVJQO9NZG00F_jGSc4fAERU,93538
|
504
504
|
pyegeria/glossary_manager_omvs.py,sha256=CN04lhnAFk_g4soE5V_jZ0GDrLPClhX5yX9iE0t6NDk,132440
|
505
|
-
pyegeria/mermaid_utilities.py,sha256=
|
505
|
+
pyegeria/mermaid_utilities.py,sha256=I3UwXbEl1wyZnKl7_-SSH7lp9FgmMuLWCxCtdezXtho,23327
|
506
506
|
pyegeria/metadata_explorer_omvs.py,sha256=u66o4IOhSo-i75KYeHogGql-gECBzZPT-RYbvfYuzoI,86932
|
507
507
|
pyegeria/my_profile_omvs.py,sha256=i0e29KXRKZzZGgxuQI7c2_w7dyDuQWFIykky1Nqc0_8,34673
|
508
508
|
pyegeria/platform_services.py,sha256=xlF5p5HPKDGTFFDsuxm2RLhr8vjZPv4T7e2qCkDgKXE,41654
|
@@ -515,8 +515,8 @@ pyegeria/template_manager_omvs.py,sha256=o_qCIFTRLK8b9C3N99taLji8VkDygo1Ss0fua35
|
|
515
515
|
pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
|
516
516
|
pyegeria/valid_metadata_omvs.py,sha256=UyIT4DfB1_QIG55Hmop7ozbsq8cNdrpYB7Tb6EOFiN8,65035
|
517
517
|
pyegeria/x_action_author_omvs.py,sha256=6b725SPsC52AI7ols7Qq8MsBlZuAXr_BgJ_-ychVRCw,6386
|
518
|
-
pyegeria-5.3.4.4.
|
519
|
-
pyegeria-5.3.4.4.
|
520
|
-
pyegeria-5.3.4.4.
|
521
|
-
pyegeria-5.3.4.4.
|
522
|
-
pyegeria-5.3.4.4.
|
518
|
+
pyegeria-5.3.4.4.dev5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
519
|
+
pyegeria-5.3.4.4.dev5.dist-info/METADATA,sha256=Oqn7dNo3wwYvSLuFHZRtT6RdziI6hQL2EXIBpNTGric,2740
|
520
|
+
pyegeria-5.3.4.4.dev5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
521
|
+
pyegeria-5.3.4.4.dev5.dist-info/entry_points.txt,sha256=E83aZ9RhrxffYGmHgBwhLdS5fvEeYhrIPp0FZRvaFOI,6180
|
522
|
+
pyegeria-5.3.4.4.dev5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|