Merge branch 'main' into workspaces
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
commit
d42837d597
5 changed files with 69 additions and 48 deletions
12
index.html
12
index.html
|
@ -211,7 +211,7 @@
|
|||
<br />
|
||||
<span id="version">
|
||||
<a href="https://github.com/zero01101/openOutpaint" target="_blank">
|
||||
Alpha release v0.0.13
|
||||
Alpha release v0.0.13.1
|
||||
</a>
|
||||
<br />
|
||||
<a
|
||||
|
@ -278,7 +278,7 @@
|
|||
<button
|
||||
type="button"
|
||||
title="Add Layer"
|
||||
onclick="commands.runCommand('addLayer', 'Added Layer')"
|
||||
onclick="commands.runCommand('addLayer', 'Added Layer', {})"
|
||||
class="ui icon button">
|
||||
<div class="icon-file-plus"></div>
|
||||
</button>
|
||||
|
@ -370,7 +370,7 @@
|
|||
<script src="js/lib/ui.js?v=fe9b702" type="text/javascript"></script>
|
||||
|
||||
<script
|
||||
src="js/initalize/layers.populate.js?v=8bc8815"
|
||||
src="js/initalize/layers.populate.js?v=066dc8e"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<!-- Configuration -->
|
||||
|
@ -379,7 +379,11 @@
|
|||
|
||||
<!-- Content -->
|
||||
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
|
||||
<<<<<<< HEAD
|
||||
<script src="js/index.js?v=f6a7238" type="text/javascript"></script>
|
||||
=======
|
||||
<script src="js/index.js?v=4c9e978" type="text/javascript"></script>
|
||||
>>>>>>> main
|
||||
|
||||
<script
|
||||
src="js/ui/floating/history.js?v=fc92d14"
|
||||
|
@ -398,7 +402,7 @@
|
|||
src="js/ui/tool/maskbrush.js?v=d88810f"
|
||||
type="text/javascript"></script>
|
||||
<script
|
||||
src="js/ui/tool/colorbrush.js?v=3f8c01a"
|
||||
src="js/ui/tool/colorbrush.js?v=6f1d2f4"
|
||||
type="text/javascript"></script>
|
||||
<script
|
||||
src="js/ui/tool/select.js?v=460dc4d"
|
||||
|
|
69
js/index.js
69
js/index.js
|
@ -868,7 +868,6 @@ function drawBackground() {
|
|||
bgLayer.canvas.style.backgroundImage = `url(${url})`;
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
async function exportWorkspaceState() {
|
||||
|
@ -994,36 +993,48 @@ async function getUpscalers() {
|
|||
*/
|
||||
|
||||
// hacky way to get the correct list of upscalers
|
||||
var extras_url =
|
||||
document.getElementById("host").value + "/sdapi/v1/extra-single-image/"; // endpoint for upscaling, needed for the hacky way to get the correct list of upscalers
|
||||
var empty_image = new Image(1, 1);
|
||||
var purposefully_incorrect_data = {
|
||||
"resize-mode": 0, // 0 = just resize, 1 = crop and resize, 2 = resize and fill i assume based on theimg2img tabs options
|
||||
upscaling_resize: 2,
|
||||
upscaler_1: "fake_upscaler",
|
||||
image: empty_image.src,
|
||||
};
|
||||
// var extras_url =
|
||||
// document.getElementById("host").value + "/sdapi/v1/extra-single-image/"; // endpoint for upscaling, needed for the hacky way to get the correct list of upscalers
|
||||
// var purposefully_incorrect_data = {
|
||||
// resize_mode: 0, // 0 = just resize, 1 = crop and resize, 2 = resize and fill i assume based on theimg2img tabs options
|
||||
// upscaling_resize: 2,
|
||||
// upscaler_1: "fake_upscaler",
|
||||
// image: empty_image.toDataURL(),
|
||||
// };
|
||||
|
||||
upscalers = [
|
||||
"Lanczos",
|
||||
"Nearest",
|
||||
"LDSR",
|
||||
"SwinIR",
|
||||
"R-ESRGAN General 4xV3",
|
||||
"R-ESRGAN General WDN 4xV3",
|
||||
"R-ESRGAN AnimeVideo",
|
||||
"R-ESRGAN 4x+",
|
||||
"R-ESRGAN 4x+ Anime6B",
|
||||
"R-ESRGAN 2x+",
|
||||
];
|
||||
|
||||
try {
|
||||
const response = await fetch(extras_url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(purposefully_incorrect_data),
|
||||
});
|
||||
const data = await response.json();
|
||||
// const response = await fetch(extras_url, {
|
||||
// method: "POST",
|
||||
// headers: {
|
||||
// Accept: "application/json",
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// body: JSON.stringify(purposefully_incorrect_data),
|
||||
// });
|
||||
// const data = await response.json();
|
||||
|
||||
console.log(
|
||||
"[index] purposefully_incorrect_data response, ignore above error"
|
||||
);
|
||||
// result = purposefully_incorrect_data response: Invalid upscaler, needs to be on of these: None , Lanczos , Nearest , LDSR , BSRGAN , R-ESRGAN General 4xV3 , R-ESRGAN 4x+ Anime6B , ScuNET , ScuNET PSNR , SwinIR_4x
|
||||
const upscalersPlusNone = data.detail
|
||||
.split(": ")[1]
|
||||
.split(",")
|
||||
.map((v) => v.trim()); // need "None" for stupid hrfix changes razza frazza
|
||||
const upscalers = upscalersPlusNone.filter((v) => v !== "None"); // converting the result to a list of upscalers
|
||||
// console.log(
|
||||
// "[index] purposefully_incorrect_data response, ignore above error"
|
||||
// );
|
||||
// // result = purposefully_incorrect_data response: Invalid upscaler, needs to be on of these: None , Lanczos , Nearest , LDSR , BSRGAN , R-ESRGAN General 4xV3 , R-ESRGAN 4x+ Anime6B , ScuNET , ScuNET PSNR , SwinIR_4x
|
||||
// const upscalersPlusNone = data.detail
|
||||
// .split(": ")[1]
|
||||
// .split(",")
|
||||
// .map((v) => v.trim()); // need "None" for stupid hrfix changes razza frazza
|
||||
// const upscalers = upscalersPlusNone.filter((v) => v !== "None"); // converting the result to a list of upscalers
|
||||
// upscalersPlusNone.push([
|
||||
// "Latent",
|
||||
// "Latent (antialiased)",
|
||||
|
@ -1031,6 +1042,8 @@ async function getUpscalers() {
|
|||
// "Latent (bicubic, antialiased)",
|
||||
// "Latent (nearest)",
|
||||
// ]);
|
||||
const upscalersPlusNone = [...upscalers];
|
||||
upscalersPlusNone.unshift("None"); //this is absurd
|
||||
upscalersPlusNone.push("Latent");
|
||||
upscalersPlusNone.push("Latent (antialiased)");
|
||||
upscalersPlusNone.push("Latent (bicubic)");
|
||||
|
|
|
@ -307,28 +307,28 @@ mouse.listen.camera.onwheel.on((evn) => {
|
|||
evn.evn.preventDefault();
|
||||
|
||||
// Get cursor world position
|
||||
const cursorPosition = viewport.viewToCanvas(evn.x, evn.y);
|
||||
const wcursor = viewport.viewToCanvas(evn.x, evn.y);
|
||||
|
||||
// Get viewport center
|
||||
const pcx = viewport.cx;
|
||||
const pcy = viewport.cy;
|
||||
const wcx = viewport.cx;
|
||||
const wcy = viewport.cy;
|
||||
|
||||
// Apply zoom
|
||||
viewport.zoom *= 1 + evn.delta * 0.0002;
|
||||
|
||||
// Get cursor new world position
|
||||
const nwcursor = viewport.viewToCanvas(evn.x, evn.y);
|
||||
|
||||
// Apply normal zoom (center of viewport)
|
||||
viewport.cx = pcx;
|
||||
viewport.cy = pcy;
|
||||
viewport.cx = wcx;
|
||||
viewport.cy = wcy;
|
||||
|
||||
// Move viewport to keep cursor in same location
|
||||
viewport.cx += wcursor.x - nwcursor.x;
|
||||
viewport.cy += wcursor.y - nwcursor.y;
|
||||
|
||||
viewport.transform(imageCollection.element);
|
||||
|
||||
// Calculate new viewport center and move
|
||||
//const newCursorPosition = viewport.viewToCanvas(evn.x, evn.y);
|
||||
//viewport.cx = pcx - (newCursorPosition.x - cursorPosition.x);
|
||||
//viewport.cy = pcy - (newCursorPosition.y - cursorPosition.y);
|
||||
|
||||
//viewport.transform(imageCollection.element);
|
||||
|
||||
toolbar._current_tool.redrawui && toolbar._current_tool.redrawui();
|
||||
});
|
||||
|
||||
|
|
|
@ -22,8 +22,10 @@ const _color_brush_draw_callback = (evn, state) => {
|
|||
};
|
||||
|
||||
const _color_brush_erase_callback = (evn, state, ctx) => {
|
||||
ctx.save();
|
||||
ctx.strokeStyle = "black";
|
||||
|
||||
ctx.filter = "blur(" + state.brushBlur + "px)";
|
||||
ctx.lineWidth = state.brushSize;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(
|
||||
|
@ -33,6 +35,7 @@ const _color_brush_erase_callback = (evn, state, ctx) => {
|
|||
ctx.lineTo(evn.x, evn.y);
|
||||
ctx.lineJoin = ctx.lineCap = "round";
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
const colorBrushTool = () =>
|
||||
|
|
|
@ -282,6 +282,11 @@ const selectTransformTool = () =>
|
|||
}
|
||||
);
|
||||
|
||||
// Draw Image
|
||||
const {canvas, bb} = cropCanvas(state.originalDisplayLayer.canvas, {
|
||||
border: 10,
|
||||
});
|
||||
|
||||
let commandLog = "";
|
||||
const addline = (v, newline = true) => {
|
||||
commandLog += v;
|
||||
|
@ -302,10 +307,6 @@ const selectTransformTool = () =>
|
|||
false
|
||||
);
|
||||
|
||||
// Draw Image
|
||||
const {canvas, bb} = cropCanvas(state.originalDisplayLayer.canvas, {
|
||||
border: 10,
|
||||
});
|
||||
commands.runCommand(
|
||||
"drawImage",
|
||||
"Transform Tool Apply",
|
||||
|
|
Loading…
Reference in a new issue