diff --git a/js/Canvas_view.js b/js/Canvas_view.js
index d5d5c31..ea0c194 100644
--- a/js/Canvas_view.js
+++ b/js/Canvas_view.js
@@ -126,10 +126,90 @@ async function createCanvasWidget(node, widget, app) {
.blend-mode-item.active {
background-color: rgba(0,0,0,0.1);
+ }
+
+ .blend-mode-item.active {
+ background-color: rgba(0,0,0,0.1);
+ }
+
+ .painter-tooltip {
+ position: fixed; /* Pozycjonowanie względem okna przeglądarki */
+ display: none; /* Domyślnie ukryty */
+ background: #3a3a3a;
+ color: #f0f0f0;
+ border: 1px solid #555;
+ border-radius: 8px;
+ padding: 12px 18px;
+ z-index: 1001; /* Wyżej niż inne elementy UI */
+ font-size: 13px;
+ line-height: 1.7;
+ max-width: 400px;
+ box-shadow: 0 4px 12px rgba(0,0,0,0.3);
+ pointer-events: none; /* Zapobiega interakcji myszy z dymkiem */
+ }
+
+ .painter-tooltip h4 {
+ margin-top: 10px;
+ margin-bottom: 5px;
+ color: #4a90e2; /* Jasnoniebieski akcent */
+ border-bottom: 1px solid #555;
+ padding-bottom: 4px;
+ }
+
+ .painter-tooltip ul {
+ list-style: none;
+ padding-left: 10px;
+ margin: 0;
+ }
+
+ .painter-tooltip kbd {
+ background-color: #2a2a2a;
+ border: 1px solid #1a1a1a;
+ border-radius: 3px;
+ padding: 2px 6px;
+ font-family: monospace;
+ font-size: 12px;
+ color: #d0d0d0;
}
`;
document.head.appendChild(style);
+ const helpTooltip = $el("div.painter-tooltip", {
+ id: `painter-help-tooltip-${node.id}`,
+ innerHTML: `
+
General
+
+ - Click + Drag - Pan canvas
+ - Mouse Wheel - Zoom in/out
+ - Shift + Click (background) - Resize canvas area
+ - Double Click (background) - Deselect all layers
+ - Drag & Drop Image File - Add image as a new layer
+
+ Layer Interaction
+
+ - Click + Drag - Move layer
+ - Ctrl + Click - Add/Remove layer from selection
+ - Alt + Drag - Clone selected layer(s)
+ - Shift + Click - Show blend mode & opacity menu
+ - Mouse Wheel - Scale selected layer(s)
+ - Shift + Mouse Wheel - Rotate selected layer(s)
+ - Arrow Keys - Nudge layer by 1px
+ - Shift + Arrow Keys - Nudge layer by 10px
+ - [ or ] - Rotate by 1°
+ - Shift + [ or ] - Rotate by 10°
+ - Delete - Delete selected layer(s)
+
+ Transform Handles (when layer selected)
+
+ - Drag Corner/Side - Resize layer
+ - Drag Rotation Handle - Rotate layer
+ - Hold Shift - Keep aspect ratio / Snap rotation to 15°
+ - Hold Ctrl - Snap to grid
+
+ `
+ });
+
+ document.body.appendChild(helpTooltip);
const controlPanel = $el("div.painterControlPanel", {}, [
$el("div.controls.painter-controls", {
style: {
@@ -154,6 +234,25 @@ async function createCanvasWidget(node, widget, app) {
canvasContainer.style.top = (controlsHeight + 10) + "px";
}
}, [
+ $el("button.painter-button", {
+ textContent: "?",
+ title: "Show shortcuts",
+ style: {
+ minWidth: "30px",
+ maxWidth: "30px",
+ fontWeight: "bold",
+ },
+ onmouseenter: (e) => {
+ const rect = e.target.getBoundingClientRect();
+ // Pozycjonujemy dymek pod przyciskiem
+ helpTooltip.style.left = `${rect.left}px`;
+ helpTooltip.style.top = `${rect.bottom + 5}px`;
+ helpTooltip.style.display = 'block';
+ },
+ onmouseleave: () => {
+ helpTooltip.style.display = 'none';
+ }
+ }),
$el("button.painter-button.primary", {
textContent: "Add Image",
onclick: () => {
@@ -469,8 +568,6 @@ async function createCanvasWidget(node, widget, app) {
}
}
})
-
-
])
]);
@@ -901,6 +998,18 @@ app.registerExtension({
return r;
};
+
+ const onRemoved = nodeType.prototype.onRemoved;
+ nodeType.prototype.onRemoved = function () {
+ // Usuń dymek z podpowiedziami, jeśli istnieje
+ const tooltip = document.getElementById(`painter-help-tooltip-${this.id}`);
+ if (tooltip) {
+ tooltip.remove();
+ }
+ return onRemoved?.apply(this, arguments);
+ };
+
+
const originalGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
nodeType.prototype.getExtraMenuOptions = function (_, options) {
originalGetExtraMenuOptions?.apply(this, arguments);