mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 03:10:21 +00:00
Run eslint --fix
(and normalize tabs to spaces)
This commit is contained in:
@@ -4,17 +4,17 @@
|
||||
*/
|
||||
function imageMaskResize() {
|
||||
const canvases = gradioApp().querySelectorAll('#img2maskimg .touch-none canvas');
|
||||
if ( ! canvases.length ) {
|
||||
canvases_fixed = false; // TODO: this is unused..?
|
||||
window.removeEventListener( 'resize', imageMaskResize );
|
||||
return;
|
||||
if (!canvases.length) {
|
||||
canvases_fixed = false; // TODO: this is unused..?
|
||||
window.removeEventListener('resize', imageMaskResize);
|
||||
return;
|
||||
}
|
||||
|
||||
const wrapper = canvases[0].closest('.touch-none');
|
||||
const previewImage = wrapper.previousElementSibling;
|
||||
|
||||
if ( ! previewImage.complete ) {
|
||||
previewImage.addEventListener( 'load', imageMaskResize);
|
||||
if (!previewImage.complete) {
|
||||
previewImage.addEventListener('load', imageMaskResize);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ function imageMaskResize() {
|
||||
const nh = previewImage.naturalHeight;
|
||||
const portrait = nh > nw;
|
||||
|
||||
const wW = Math.min(w, portrait ? h/nh*nw : w/nw*nw);
|
||||
const wH = Math.min(h, portrait ? h/nh*nh : w/nw*nh);
|
||||
const wW = Math.min(w, portrait ? h / nh * nw : w / nw * nw);
|
||||
const wH = Math.min(h, portrait ? h / nh * nh : w / nw * nh);
|
||||
|
||||
wrapper.style.width = `${wW}px`;
|
||||
wrapper.style.height = `${wH}px`;
|
||||
wrapper.style.left = `0px`;
|
||||
wrapper.style.top = `0px`;
|
||||
|
||||
canvases.forEach( c => {
|
||||
canvases.forEach(c => {
|
||||
c.style.width = c.style.height = '';
|
||||
c.style.maxWidth = '100%';
|
||||
c.style.maxHeight = '100%';
|
||||
@@ -41,4 +41,4 @@ function imageMaskResize() {
|
||||
}
|
||||
|
||||
onUiUpdate(imageMaskResize);
|
||||
window.addEventListener( 'resize', imageMaskResize);
|
||||
window.addEventListener('resize', imageMaskResize);
|
||||
|
Reference in New Issue
Block a user