Compare commits
2 Commits
kolory,poł
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b76c1df3a | |||
| 4cb50a4276 |
28
index.html
28
index.html
@@ -24,9 +24,10 @@
|
|||||||
<button id="btn-copy">Kopiuj</button>
|
<button id="btn-copy">Kopiuj</button>
|
||||||
<button id="btn-paste">Wklej</button>
|
<button id="btn-paste">Wklej</button>
|
||||||
<button id="btn-connect">Połącz</button>
|
<button id="btn-connect">Połącz</button>
|
||||||
<div class="color-wrapper"><!-- DODANE -->
|
<div class="color-wrapper">
|
||||||
<button id="btn-change-color">Kolor</button> <!-- DODANE -->
|
<button id="btn-change-color">Kolor</button>
|
||||||
<div id="color-palette" style="position:absolute; display:none; padding:8px; background:#fff; border:1px solid #ccc; border-radius:6px; gap:6px; z-index:2000;"></div>
|
<div id="color-palette"
|
||||||
|
style="position:absolute; display:none; padding:8px; background:#fff; border:1px solid #ccc; border-radius:6px; gap:6px; z-index:2000;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>Zoom</p>
|
<p>Zoom</p>
|
||||||
@@ -41,9 +42,6 @@
|
|||||||
<div id="paper"></div>
|
<div id="paper"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- DODANY KONTAINER DLA PALETY KOLORÓW -->
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
||||||
<script src="joint.js"></script>
|
<script src="joint.js"></script>
|
||||||
@@ -97,7 +95,8 @@
|
|||||||
if (selectedElement.attributes.type === 'standard.TextBlock') {
|
if (selectedElement.attributes.type === 'standard.TextBlock') {
|
||||||
selectedElement.attr('label/fill', c);
|
selectedElement.attr('label/fill', c);
|
||||||
}
|
}
|
||||||
} catch(e) { /* ignoruj */ }
|
} catch (e) { /* ignoruj */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$palette.hide();
|
$palette.hide();
|
||||||
});
|
});
|
||||||
@@ -207,6 +206,7 @@
|
|||||||
const elementView = textBlock.findView(paper);
|
const elementView = textBlock.findView(paper);
|
||||||
elementView.addTools(createToolsView());
|
elementView.addTools(createToolsView());
|
||||||
}
|
}
|
||||||
|
|
||||||
//create shape - END
|
//create shape - END
|
||||||
|
|
||||||
//init draggalble - START
|
//init draggalble - START
|
||||||
@@ -264,6 +264,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//init draggable - END
|
//init draggable - END
|
||||||
|
|
||||||
function getViewportCenter() {
|
function getViewportCenter() {
|
||||||
@@ -379,14 +380,20 @@
|
|||||||
|
|
||||||
//add text to text block - START
|
//add text to text block - START
|
||||||
paper.on('element:contextmenu', function (elementView, ev) {
|
paper.on('element:contextmenu', function (elementView, ev) {
|
||||||
ev.preventDefault();
|
|
||||||
if (elementView.model.attributes.type === 'standard.TextBlock') {
|
if (elementView.model.attributes.type === 'standard.TextBlock') {
|
||||||
|
ev.preventDefault();
|
||||||
const currentText = elementView.model.attr('label/text');
|
const currentText = elementView.model.attr('label/text');
|
||||||
const newText = prompt('Edytuj tekst:', currentText);
|
const newText = prompt('Edytuj tekst:', currentText);
|
||||||
if (newText != null) {
|
if (newText != null) {
|
||||||
elementView.model.attr('label/text', newText);
|
elementView.model.attr('label/text', newText);
|
||||||
}
|
}
|
||||||
|
} else if (elementView.model.attributes.type !== 'standard.TextBlock') {
|
||||||
|
ev.preventDefault();
|
||||||
|
const currentText = elementView.model.attr('label/text') || '';
|
||||||
|
const newText = prompt('Edytuj tekst:', currentText);
|
||||||
|
if (newText != null) {
|
||||||
|
elementView.model.attr('label/text', newText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -470,7 +477,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function hideResizeHandle() {
|
function hideResizeHandle() {
|
||||||
if ($resizeHandle.data('ui-resizable')) {
|
if ($resizeHandle.data('ui-resizable')) {
|
||||||
$resizeHandle.resizable('destroy');
|
$resizeHandle.resizable('destroy');
|
||||||
@@ -500,8 +506,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
const zoomStep = 0.2;
|
const zoomStep = 0.2;
|
||||||
const minScale = 0.2;
|
const minScale = 0.2;
|
||||||
|
|||||||
Reference in New Issue
Block a user