Started handling pivot buttons

This commit is contained in:
unsettledgames 2020-09-13 11:21:23 +02:00
parent a56c9576a9
commit d8cfd14ded
4 changed files with 27 additions and 12 deletions

View File

@ -967,7 +967,7 @@ svg {
position:relative; position:relative;
width:40px; width:40px;
height:40px; height:40px;
background:color(menu, background); background-color:color(base, background);
border:none; border:none;
path { path {

View File

@ -6,8 +6,6 @@ function getCursorPosition(e) {
if (e.pageX != undefined && e.pageY != undefined) { if (e.pageX != undefined && e.pageY != undefined) {
x = e.pageX; x = e.pageX;
y = e.pageY; y = e.pageY;
console.log("passato di qui");
} }
else { else {
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;

View File

@ -2,6 +2,23 @@ let resizeCanvasContainer = document.getElementById("resize-canvas");
function openResizeCanvasWindow() { function openResizeCanvasWindow() {
showDialogue('resize-canvas'); showDialogue('resize-canvas');
console.log("aperta");
initButtons();
}
function initButtons() {
let buttons = document.getElementsByClassName("pivot-button");
console.log("length: " + buttons.length);
for (let i=0; i<buttons.length; i++) {
buttons[i].addEventListener("click", changePivot);
}
}
function changePivot(event) {
console.log("sas");
console.log(event.target);
} }
// Use a dialogue // Use a dialogue

View File

@ -256,15 +256,15 @@
<!--PIVOTS--> <!--PIVOTS-->
<span id = "pivot-menu"> <span id = "pivot-menu">
<button>{{svg "arrows/topleft.svg" width="20" height="20"}}</button> <button class="pivot-button" value="topleft">{{svg "arrows/topleft.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/top.svg" width="20" height="20"}}</button> <button class="pivot-button" value="top">{{svg "arrows/top.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/topright.svg" width="20" height="20"}}</button> <button class="pivot-button" value="topright">{{svg "arrows/topright.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/left.svg" width="20" height="20"}}</button> <button class="pivot-button" value="left">{{svg "arrows/left.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/middle.svg" width="20" height="20"}}</button> <button class="pivot-button" value="middle">{{svg "arrows/middle.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/right.svg" width="20" height="20"}}</button> <button class="pivot-button" value="right">{{svg "arrows/right.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/bottomleft.svg" width="20" height="20"}}</button> <button class="pivot-button" value="bottomleft">{{svg "arrows/bottomleft.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/bottom.svg" width="20" height="20"}}</button> <button class="pivot-button" value="bottom">{{svg "arrows/bottom.svg" width="20" height="20"}}</button>
<button>{{svg "arrows/bottomright.svg" width="20" height="20"}}</button> <button class="pivot-button" value="bottomright">{{svg "arrows/bottomright.svg" width="20" height="20"}}</button>
</span> </span>
<!--BORDERS--> <!--BORDERS-->
<span id = "borders-menu"> <span id = "borders-menu">