From afe71482758d953d819daab995bf5400029396d3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 30 Jun 2015 00:00:24 -0400 Subject: fix sizing issues --- js/matrix.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/matrix.js') diff --git a/js/matrix.js b/js/matrix.js index ff513d9..0f38eeb 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -185,16 +185,20 @@ Matrix.prototype.resize = function(w,h){ this.rapper && this.resize_rapper() } Matrix.prototype.resize_rapper = function(){ + var cw = this.aa[0][0].span.offsetWidth + var ch = this.aa[0][0].span.offsetHeight + if (this.grid) { cw++; ch++ } + var width = cw * this.aa[0].length + var height = ch * this.aa.length + if (this.grid) { width++; height++ } if (this.rotated) { this.rapper.parentNode.classList.add("rotated") - this.rapper.parentNode.style.height = (this.rapper.firstChild.offsetWidth+20) + "px" - this.rapper.parentNode.style.width = (this.rapper.offsetHeight+20) + "px" - this.rapper.style.top = ((this.rapper.offsetWidth+20)/2) + "px" + this.rapper.parentNode.style.height = (width) + "px" + this.rapper.parentNode.style.width = (height) + "px" + this.rapper.style.top = (width/2) + "px" // this.rapper.style.left = ((canvas_rapper.offsetHeight+20)/2) + "px" } else { - var width = this.aa[0][0].span.offsetWidth * this.aa[0].length - console.log(width, this.rapper.firstChild.offsetWidth) this.rapper.parentNode.classList.remove("rotated") this.rapper.parentNode.style.height = "" this.rapper.style.width = -- cgit v1.2.3-70-g09d2