Bernd Wurst commited on 2026-06-21 11:27:01
Zeige 3 geänderte Dateien mit 32 Einfügungen und 6 Löschungen.
| ... | ... |
@@ -79,7 +79,9 @@ |
| 79 | 79 |
<button id="btn-download" class="btn-primary" py-click="download_svg"> |
| 80 | 80 |
SVG herunterladen |
| 81 | 81 |
</button> |
| 82 |
- |
|
| 82 |
+ <button id="btn-copy-link" class="btn-secondary" py-click="kopiere_permalink" style="margin-top: 8px;"> |
|
| 83 |
+ 🔗 Permalink kopieren |
|
| 84 |
+ </button> |
|
| 83 | 85 |
</div> |
| 84 | 86 |
|
| 85 | 87 |
<div class="main-content"> |
| ... | ... |
@@ -135,6 +135,30 @@ def download_svg(event=None): |
| 135 | 135 |
window.eval(js_code) |
| 136 | 136 |
|
| 137 | 137 |
|
| 138 |
+def kopiere_permalink(event=None): |
|
| 139 |
+ # Die komplette aktuelle URL inklusive des gehashten Zustands auslesen |
|
| 140 |
+ aktuelle_url = window.location.href |
|
| 141 |
+ |
|
| 142 |
+ # Per JavaScript in die Zwischenablage schreiben und Button-Text animieren |
|
| 143 |
+ js_code = f""" |
|
| 144 |
+ navigator.clipboard.writeText("{aktuelle_url}").then(function() {{
|
|
| 145 |
+ var btn = document.querySelector("#btn-copy-link");
|
|
| 146 |
+ var alterText = btn.innerHTML; |
|
| 147 |
+ btn.innerHTML = "✓ Kopiert!"; |
|
| 148 |
+ btn.style.backgroundColor = "#28a745"; // Kurz grün färben |
|
| 149 |
+ btn.style.color = "white"; |
|
| 150 |
+ |
|
| 151 |
+ setTimeout(function() {{
|
|
| 152 |
+ btn.innerHTML = alterText; |
|
| 153 |
+ btn.style.backgroundColor = ""; // Zurück zum CSS-Standard |
|
| 154 |
+ btn.style.color = ""; |
|
| 155 |
+ }}, 2000); |
|
| 156 |
+ }}).catch(function(err) {{
|
|
| 157 |
+ alert("Fehler beim Kopieren: " + err);
|
|
| 158 |
+ }}); |
|
| 159 |
+ """ |
|
| 160 |
+ window.eval(js_code) |
|
| 161 |
+ |
|
| 138 | 162 |
# --- START-SEQUENZ --- |
| 139 | 163 |
# 1. Prüfen, ob Voreinstellungen aus einem Link geladen werden müssen |
| 140 | 164 |
lade_zustand_aus_url() |
| ... | ... |
@@ -100,8 +100,8 @@ class SchraegbildBuilder: |
| 100 | 100 |
stroke='black' if i > 0 else '#777777', stroke_width=1)) |
| 101 | 101 |
if i % self.mod_x1 == 0: |
| 102 | 102 |
offset_x = p_tick[0] - 18 if i < 0 else p_tick[0] - 16 |
| 103 |
- dwg.add(dwg.text(str(i), insert=(offset_x, p_tick[1] - 6 if i > 0 else p_tick[1] + 8), |
|
| 104 |
- style=text_style if i > 0 else text_style_neg)) |
|
| 103 |
+ dwg.add( |
|
| 104 |
+ dwg.text(str(i), insert=(offset_x, p_tick[1] - 6), style=text_style if i > 0 else text_style_neg)) |
|
| 105 | 105 |
|
| 106 | 106 |
for i in range(-self.neg_x2, self.len_x2 + 1): |
| 107 | 107 |
if i == 0: continue |
| ... | ... |
@@ -128,11 +128,11 @@ class SchraegbildBuilder: |
| 128 | 128 |
p_x1_label = self.to_svg(self.len_x1 + 1, 0, 0) |
| 129 | 129 |
p_x2_label = self.to_svg(0, self.len_x2 + 1, 0) |
| 130 | 130 |
p_x3_label = self.to_svg(0, 0, self.len_x3 + 1) |
| 131 |
- dwg.add(dwg.text("x₁", insert=(p_x1_label[0] - 15, p_x1_label[1] + 20),
|
|
| 131 |
+ dwg.add(dwg.text("x₁", insert=(p_x1_label[0] - 20, p_x1_label[1] - 5),
|
|
| 132 | 132 |
style="font-family:Arial; font-size:14px; font-weight:bold;")) |
| 133 |
- dwg.add(dwg.text("x₂", insert=(p_x2_label[0] + 12, p_x2_label[1] + 5),
|
|
| 133 |
+ dwg.add(dwg.text("x₂", insert=(p_x2_label[0] - 10, p_x2_label[1] + 20),
|
|
| 134 | 134 |
style="font-family:Arial; font-size:14px; font-weight:bold;")) |
| 135 |
- dwg.add(dwg.text("x₃", insert=(p_x3_label[0] - 5, p_x3_label[1] - 15),
|
|
| 135 |
+ dwg.add(dwg.text("x₃", insert=(p_x3_label[0] - 25, p_x3_label[1] + 10),
|
|
| 136 | 136 |
style="font-family:Arial; font-size:14px; font-weight:bold;")) |
| 137 | 137 |
|
| 138 | 138 |
# --- NEU: ERST DIE KANTEN ZEICHNEN --- |
| 139 | 139 |