Merge branch 'main' into manual-scripts

This commit is contained in:
tim h 2023-01-31 18:06:16 -06:00
commit ec1699e0a3
2 changed files with 31 additions and 7 deletions

View file

@ -476,7 +476,7 @@
src="js/ui/tool/colorbrush.js?v=46011ee"
type="text/javascript"></script>
<script
src="js/ui/tool/select.js?v=63fe672"
src="js/ui/tool/select.js?v=39911b2"
type="text/javascript"></script>
<script src="js/ui/tool/stamp.js?v=455f9fe" type="text/javascript"></script>
<script

View file

@ -735,9 +735,21 @@ const selectTransformTool = () =>
saveVisibleSelectionButton.textContent = "Save Vis.";
saveVisibleSelectionButton.title = "Saves Visible Selection";
saveVisibleSelectionButton.onclick = () => {
const canvas = uil.getVisible(state.selected, {
categories: ["image", "user", "select-display"],
});
const canvas = uil.getVisible(
{
x:
state._selected._position.x -
state._selected.canvas.width / 2,
y:
state._selected._position.y -
state._selected.canvas.height / 2,
w: state._selected.canvas.width,
h: state._selected.canvas.height,
},
{
categories: ["image", "user", "select-display"],
}
);
downloadCanvas({
cropToContent: false,
canvas,
@ -751,9 +763,21 @@ const selectTransformTool = () =>
createVisibleResourceButton.title =
"Saves Visible Selection as a Resource";
createVisibleResourceButton.onclick = () => {
const canvas = uil.getVisible(state.selected, {
categories: ["image", "user", "select-display"],
});
const canvas = uil.getVisible(
{
x:
state._selected._position.x -
state._selected.canvas.width / 2,
y:
state._selected._position.y -
state._selected.canvas.height / 2,
w: state._selected.canvas.width,
h: state._selected.canvas.height,
},
{
categories: ["image", "user", "select-display"],
}
);
const image = document.createElement("img");
image.src = canvas.toDataURL();
image.onload = () => {