add some logging for #133
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
af5b9b9680
commit
f064719515
5 changed files with 38 additions and 15 deletions
|
@ -247,7 +247,7 @@
|
|||
<div class="draggable floating-window-title">
|
||||
History
|
||||
<div style="flex: 1"></div>
|
||||
<button id="settings-btn" class="ui icon header-button">
|
||||
<button id="history-logs-btn" class="ui icon header-button">
|
||||
<div class="icon-scroll"></div>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* @property {() => void | Promise<void>} redo A method to redo whatever undo did
|
||||
* @property {() => any | Promise<any>} export A method to export the command
|
||||
* @property {{[key: string]: any}} state The state of the current command instance
|
||||
* @property {{[key: string]: any}} extra Extra information saved with the command
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
(() => {
|
||||
const historyLogBtn = document.getElementById("history-logs-btn");
|
||||
historyLogBtn.addEventListener("click", () => {
|
||||
let logs = "";
|
||||
commands._history.forEach((entry) => {
|
||||
if (entry.extra.log) logs += ` => ${entry.extra.log}\n`;
|
||||
});
|
||||
|
||||
const blob = new Blob([logs], {type: "text/plain"});
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
var link = document.createElement("a"); // Or maybe get it from the current document
|
||||
link.href = url;
|
||||
link.download = `${new Date().toISOString()}_openOutpaint_log.txt`;
|
||||
link.click();
|
||||
});
|
||||
|
||||
const historyView = document.getElementById("history");
|
||||
|
||||
const makeHistoryEntry = (index, id, title) => {
|
||||
|
|
|
@ -298,7 +298,8 @@ const selectTransformTool = () =>
|
|||
` - rotation : ${
|
||||
Math.round(1000 * ((180 * state.selected.rotation) / Math.PI)) /
|
||||
1000
|
||||
} degrees`
|
||||
} degrees`,
|
||||
false
|
||||
);
|
||||
|
||||
// Draw Image
|
||||
|
|
|
@ -418,21 +418,26 @@ const stampTool = () =>
|
|||
|
||||
const resource = state.selected;
|
||||
|
||||
let commandLog = `Stamped image '${resource.name}' to x: ${resource.x} and y: ${resource.y}`;
|
||||
|
||||
const addline = (v, newline = true) => {
|
||||
commandLog += v;
|
||||
if (newline) commandLog += "\n";
|
||||
};
|
||||
addline(` - scaling : ${state.scale}`);
|
||||
addline(
|
||||
` - rotation: ${
|
||||
Math.round(1000 * ((180 * rotation) / Math.PI)) / 1000
|
||||
} degrees`
|
||||
);
|
||||
|
||||
if (resource) {
|
||||
const {canvas, bb} = cropCanvas(ovCanvas, {border: 10});
|
||||
|
||||
let commandLog = "";
|
||||
|
||||
const addline = (v, newline = true) => {
|
||||
commandLog += v;
|
||||
if (newline) commandLog += "\n";
|
||||
};
|
||||
addline(
|
||||
`Stamped image '${resource.name}' to x: ${bb.x} and y: ${bb.y}`
|
||||
);
|
||||
addline(` - scaling : ${state.scale}`);
|
||||
addline(
|
||||
` - rotation: ${
|
||||
Math.round(1000 * ((180 * rotation) / Math.PI)) / 1000
|
||||
} degrees`,
|
||||
false
|
||||
);
|
||||
|
||||
commands.runCommand(
|
||||
"drawImage",
|
||||
"Image Stamp",
|
||||
|
|
Loading…
Reference in a new issue