Fixed various little UI issues

This commit is contained in:
Devine Lu Linvega 2017-01-02 14:54:20 -07:00
parent 5aca059cac
commit 42bb3c3e80
9 changed files with 22 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

View File

@ -13,6 +13,7 @@ document.addEventListener('mousedown', function(e){ ronin.cursor.mouse_down(roni
document.addEventListener('mousemove', function(e){ ronin.cursor.mouse_move(ronin.position_in_canvas(e));}, false);
document.addEventListener('mouseup', function(e){ ronin.cursor.mouse_up(ronin.position_in_canvas(e));}, false);
// document.addEventListener('contextmenu', function(ev){ ev.preventDefault(); return false;}, false);
window.addEventListener('resize', function(){ ronin.on_resize(); }, true);
// Keyboard

View File

@ -43,7 +43,7 @@ function Ronin()
x -= parseInt(this.surface.element.style.marginLeft) + (this.surface.size.width/2);
var y = e.clientY;
y -= (window.innerHeight - this.surface.size.height)/2;
y -= parseInt(this.surface.element.style.marginTop) + (this.surface.size.height/2);
y -= parseInt(this.surface.element.style.marginTop) + parseInt(this.surface.size.height/2);
return new Position(x,y);
}
@ -58,4 +58,9 @@ function Ronin()
var date = currentdate.getFullYear()+""+(currentdate.getMonth()+1)+""+currentdate.getDate();
return date+" "+currentdate.getHours()+":"+currentdate.getMinutes()+":"+currentdate.getSeconds();
}
this.on_resize = function()
{
this.widget.on_resize();
}
}

View File

@ -14,4 +14,13 @@ function Widget()
this.element.innerHTML = s;
}
this.on_resize = function()
{
this.element.style.left = (window.innerWidth/2)-(ronin.surface.size.width/2);
this.element.style.top = (window.innerHeight/2)+(ronin.surface.size.height/2);
this.element.style.width = ronin.surface.size.width+"px";
this.update();
}
}

View File

@ -68,15 +68,12 @@ function Surface(rune)
ronin.surface.element.width = rect.width * 2;
ronin.surface.element.height = rect.height * 2;
ronin.surface.element.style.marginLeft = -(rect.width/2);
ronin.surface.element.style.marginTop = -(rect.height/2);
ronin.surface.element.style.width = rect.width+"px";
ronin.surface.element.style.height = rect.height+"px";
ronin.widget.element.style.left = (window.innerWidth/2)-(rect.width/2);
ronin.widget.element.style.top = (window.innerHeight/2)+(rect.height/2);
ronin.widget.element.style.width = rect.width+"px";
ronin.surface.element.style.marginLeft = -(rect.width/2);
ronin.surface.element.style.marginTop = -(rect.height/2);
ronin.widget.update();
ronin.on_resize();
}
this.widget = function()

View File

@ -5,8 +5,8 @@ function Position(position_str = "0,0",y = null)
this.example = "100,150";
this.position_str = position_str;
this.x = y ? position_str : parseFloat(this.position_str.split(",")[0]);
this.y = y ? y : parseFloat(this.position_str.split(",")[1]);
this.x = y != null ? position_str : parseFloat(this.position_str.split(",")[0]);
this.y = y != null ? y : parseFloat(this.position_str.split(",")[1]);
this.add = function(position)
{