From 0b67f941870b7d857b262ebe240a3fb81677dfee Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Tue, 21 Aug 2018 09:27:14 -0400 Subject: [PATCH] if you work hard and follow your dreams, you too can center
s vertically --- pixels.html | 26 ++++++++++++++++++++++---- src/pixed/pixeleditor.ts | 15 +++++++-------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/pixels.html b/pixels.html index 86f4e27d..bed8bf90 100644 --- a/pixels.html +++ b/pixels.html @@ -7,7 +7,22 @@ body { overflow: hidden !important; font-size: 11px; } -.thumb { +.thumbdiv { +} +.fcontainer +{ + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + height: 100vh; +} +.fitem +{ + background-color: #f3f2ef; + border-radius: 3px; + width: 200px; + height: 100px; } @@ -24,10 +39,13 @@ body {
- -
+
+
-
+
+
diff --git a/src/pixed/pixeleditor.ts b/src/pixed/pixeleditor.ts index f3b9d42a..b2a3c5d6 100644 --- a/src/pixed/pixeleditor.ts +++ b/src/pixed/pixeleditor.ts @@ -39,13 +39,8 @@ export function PixelEditor(parentDiv:HTMLElement, fmt, palette, initialData, th this.getImageData = function() { return pixints.slice(0); } function fitCanvas() { - var w = $(parentDiv).width(); - var h = $(parentDiv).height(); - if (h > w) - pixcanvas.style.height = Math.floor(h)+"px"; - else - pixcanvas.style.height = Math.floor(h/2)+"px"; - // TODO + pixcanvas.style.height = '50%'; // TODO? + return; } this.resize = fitCanvas; @@ -56,6 +51,7 @@ export function PixelEditor(parentDiv:HTMLElement, fmt, palette, initialData, th for (var i=0; i"); + parentdiv = $('
').appendTo("#thumbnaildiv"); } allthumbs.push(createThumbnailForImage(parentdiv, i)); } @@ -474,6 +470,9 @@ function pixelEditorReceiveMessage(e) { function createThumbnailForImage(parentdiv, i) { var span = $(''); var thumb = new PixelEditor(span[0], currentFormat, palette, allimages[i]); + // double size of canvas thumbnail + thumb.canvas.style.height = currentFormat.h*2+"px"; + thumb.canvas.style.width = currentFormat.w*2+"px"; parentdiv.append(span); span.click(function() { createEditorForImage(i) }); return thumb;