Improved design
This commit is contained in:
@@ -52,7 +52,7 @@ function Hint(element)
|
||||
var s = "<span class='module'>Modules</span>";
|
||||
|
||||
for (var key in ronin.modules){
|
||||
s += "<span class='param'>"+ronin.modules[key].constructor.name+"<span> <span class='value'>"+key+"</span> ";
|
||||
s += "<span class='param'>"+ronin.modules[key].constructor.name.substr(0,2)+"<span> <span class='value'>"+key+"</span> ";
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var ronin = new Ronin();
|
||||
ronin.element = document.getElementById('ronin');
|
||||
ronin.overlay.element = document.getElementById('overlay');
|
||||
ronin.surface.element = document.getElementById('surface');
|
||||
ronin.widget.element = document.getElementById('widget');
|
||||
@@ -14,6 +15,7 @@ document.addEventListener('mouseup', function(e){ ronin.cursor.mouse_up(ronin.po
|
||||
// document.addEventListener('contextmenu', function(ev){ ev.preventDefault(); return false;}, false);
|
||||
|
||||
// Keyboard
|
||||
|
||||
var keyboard = new Keyboard();
|
||||
document.onkeyup = function myFunction(){ keyboard.listen_onkeyup(event); };
|
||||
document.onkeydown = function myFunction(){ keyboard.listen_onkeydown(event); };
|
||||
@@ -23,6 +25,11 @@ var starting_canvas = new Rect();
|
||||
starting_canvas.width = window.innerWidth - 200;
|
||||
starting_canvas.height = window.innerHeight - 200;
|
||||
|
||||
// Clamp
|
||||
|
||||
starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
|
||||
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
|
||||
|
||||
commander.query("~ "+ronin.timestamp());
|
||||
commander.query("# "+starting_canvas.render());
|
||||
commander.query("# layer=render");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function Ronin()
|
||||
{
|
||||
this.modules = {};
|
||||
|
||||
this.element = null;
|
||||
this.widget = new Widget();
|
||||
|
||||
this.overlay = new Overlay("|");
|
||||
@@ -36,14 +36,19 @@ function Ronin()
|
||||
|
||||
this.position_in_canvas = function(e)
|
||||
{
|
||||
var x = e.clientX - parseFloat(ronin.surface.element.style.left);
|
||||
var y = e.clientY- parseFloat(ronin.surface.element.style.top);
|
||||
return new Position(x+","+y);
|
||||
var x = e.clientX;
|
||||
x -= (window.innerWidth - this.surface.size.width)/2;
|
||||
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);
|
||||
return new Position(x,y);
|
||||
}
|
||||
|
||||
this.position_in_window = function(p)
|
||||
{
|
||||
return new Position(p.x + parseFloat(ronin.surface.element.style.left),p.y + parseFloat(ronin.surface.element.style.top));
|
||||
console.log(p.x);
|
||||
return new Position(p.x + parseInt(this.surface.element.style.marginLeft),p.y + parseInt(this.surface.element.style.marginTop));
|
||||
}
|
||||
|
||||
this.timestamp = function()
|
||||
|
||||
Reference in New Issue
Block a user