MCPcopy Index your code
hub / github.com/AUTOMATIC1111/stable-diffusion-webui / setupResolutionPasting

Function setupResolutionPasting

javascript/ui.js:248–264  ·  view source on GitHub ↗

* Configure the width and height elements on `tabname` to accept * pasting of resolutions in the form of "width x height".

(tabname)

Source from the content-addressed store, hash-verified

246 * pasting of resolutions in the form of "width x height".
247 */
248function setupResolutionPasting(tabname) {
249 var width = gradioApp().querySelector(`#${tabname}_width input[type=number]`);
250 var height = gradioApp().querySelector(`#${tabname}_height input[type=number]`);
251 for (const el of [width, height]) {
252 el.addEventListener('paste', function(event) {
253 var pasteData = event.clipboardData.getData('text/plain');
254 var parsed = pasteData.match(/^\s*(\d+)\D+(\d+)\s*$/);
255 if (parsed) {
256 width.value = parsed[1];
257 height.value = parsed[2];
258 updateInput(width);
259 updateInput(height);
260 event.preventDefault();
261 }
262 });
263 }
264}
265
266onUiLoaded(function() {
267 showRestoreProgressButton('txt2img', localGet("txt2img_task_id"));

Callers 1

ui.jsFile · 0.85

Calls 2

gradioAppFunction · 0.85
updateInputFunction · 0.85

Tested by

no test coverage detected