fix dream cursor shows on img2img

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2023-01-03 12:50:38 -03:00
parent b128943f0c
commit 967b49842f
4 changed files with 13 additions and 11 deletions

View file

@ -328,7 +328,7 @@
<script src="js/lib/layers.js?v=a1f8aea" type="text/javascript"></script> <script src="js/lib/layers.js?v=a1f8aea" type="text/javascript"></script>
<script src="js/lib/commands.js?v=00464cb" type="text/javascript"></script> <script src="js/lib/commands.js?v=00464cb" type="text/javascript"></script>
<script src="js/lib/toolbar.js?v=d15051f" type="text/javascript"></script> <script src="js/lib/toolbar.js?v=ca3fccf" type="text/javascript"></script>
<script src="js/lib/ui.js?v=76ede2b" type="text/javascript"></script> <script src="js/lib/ui.js?v=76ede2b" type="text/javascript"></script>
<script <script
@ -354,7 +354,7 @@
src="js/ui/tool/generic.js?v=2bcd36d" src="js/ui/tool/generic.js?v=2bcd36d"
type="text/javascript"></script> type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=a68bed9" type="text/javascript"></script> <script src="js/ui/tool/dream.js?v=7c80563" type="text/javascript"></script>
<script <script
src="js/ui/tool/maskbrush.js?v=1e8a893" src="js/ui/tool/maskbrush.js?v=1e8a893"
type="text/javascript"></script> type="text/javascript"></script>

View file

@ -106,24 +106,24 @@ const toolbar = {
while (contextMenuEl.lastChild) { while (contextMenuEl.lastChild) {
contextMenuEl.removeChild(contextMenuEl.lastChild); contextMenuEl.removeChild(contextMenuEl.lastChild);
} }
options.populateContextMenu(contextMenuEl, tool.state); options.populateContextMenu(contextMenuEl, tool.state, tool);
tool._element && tool._element.classList.add("using"); tool._element && tool._element.classList.add("using");
tool.enabled = true; tool.enabled = true;
this._current_tool = tool; this._current_tool = tool;
enable(tool.state, opt); enable(tool.state, opt, tool);
}, },
disable: (opt = null) => { disable: (opt = null) => {
tool._element && tool._element.classList.remove("using"); tool._element && tool._element.classList.remove("using");
this._current_tool = null; this._current_tool = null;
tool.enabled = false; tool.enabled = false;
disable(tool.state, opt); disable(tool.state, opt, tool);
}, },
}; };
// Initalize // Initalize
options.init && options.init(tool.state); options.init && options.init(tool.state, tool);
this.tools.push(tool); this.tools.push(tool);

View file

@ -1441,7 +1441,7 @@ const dreamTool = () =>
dream_erase_callback(bb, state); dream_erase_callback(bb, state);
}; };
}, },
populateContextMenu: (menu, state) => { populateContextMenu: (menu, state, tool) => {
if (!state.ctxmenu) { if (!state.ctxmenu) {
state.ctxmenu = {}; state.ctxmenu = {};
@ -1463,7 +1463,7 @@ const dreamTool = () =>
resSlider.value = state.cursorSize; resSlider.value = state.cursorSize;
} }
state.redraw(); if (tool.enabled) state.redraw();
}, },
} }
); );
@ -1972,7 +1972,7 @@ const img2imgTool = () =>
dream_erase_callback(bb, state); dream_erase_callback(bb, state);
}; };
}, },
populateContextMenu: (menu, state) => { populateContextMenu: (menu, state, tool) => {
if (!state.ctxmenu) { if (!state.ctxmenu) {
state.ctxmenu = {}; state.ctxmenu = {};
@ -1990,6 +1990,8 @@ const img2imgTool = () =>
if (global.syncCursorSize) { if (global.syncCursorSize) {
resSlider.value = state.cursorSize; resSlider.value = state.cursorSize;
} }
if (tool.enabled) state.redraw();
}, },
} }
); );

View file

@ -8,8 +8,8 @@
<iframe <iframe
id="openoutpaint" id="openoutpaint"
style="width: 100%; height: 800px" style="width: 100%; height: 800px"
src="../index.html?v=e2520a0" src="../index.html?v=90a7170"
src="../index.html?v=49afaa2" src="../index.html?v=90a7170"
frameborder="0"></iframe> frameborder="0"></iframe>
<button id="add-res">Add Resource</button> <button id="add-res">Add Resource</button>
<script> <script>