From 3d885b2fc50de2f7f6a1fcaea037c010889be7d3 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 23 May 2017 16:11:56 -1000 Subject: [PATCH] Center on resize --- scripts/core/ronin.js | 1 + scripts/modules/frame.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/scripts/core/ronin.js b/scripts/core/ronin.js index cb2b7d8..7f1a622 100644 --- a/scripts/core/ronin.js +++ b/scripts/core/ronin.js @@ -83,6 +83,7 @@ function Ronin() this.on_resize = function() { + ronin.frame.center(); } this.on_drag = function() diff --git a/scripts/modules/frame.js b/scripts/modules/frame.js index 1b8af65..0a8abac 100644 --- a/scripts/modules/frame.js +++ b/scripts/modules/frame.js @@ -88,6 +88,12 @@ function Frame(rune) setTimeout(function(){ ronin.frame.blink(); }, 30); } + this.center = function() + { + ronin.frame.element.style.left = (window.innerWidth/2) - (ronin.frame.element.width/4); + ronin.frame.element.style.top = (window.innerHeight/2) - (ronin.frame.element.height/4) - 30; + } + this.select_layer = function(layer) { this.active_layer = layer;