From 1e4620a65076faae1d0964455eb6941cd7999e47 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Mon, 28 Apr 2014 15:38:20 -0700 Subject: [PATCH] Enhance maximize element action so that it fits/flexes appropriately. --- elements/x-design-canvas/x-design-canvas.html | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/elements/x-design-canvas/x-design-canvas.html b/elements/x-design-canvas/x-design-canvas.html index 5c06b9bf..abeb398f 100644 --- a/elements/x-design-canvas/x-design-canvas.html +++ b/elements/x-design-canvas/x-design-canvas.html @@ -133,14 +133,22 @@ } }, + // 'fit' unless we're inside a core-layout and then 'flex' maximizeElement: function() { - var r = this.ruleForElement(this.selected); - if (!r) { + var e = this.selected; + if (!e) { return; } - r.style.position = 'absolute'; - r.style.left = r.style.top = '0px'; - r.style.height = r.style.width = '100%'; + var r = this.ruleForElement(this.selected); + if (e.parentNode.localName === 'core-layout') { + r.style.position = null; + r.style.left = r.style.top = r.style.width = r.style.height = null; + e.className += ' core-flex'; + } else { + r.style.position = 'absolute'; + r.style.left = r.style.top = '0px'; + r.style.height = r.style.width = '100%'; + } // fire a fake resize event so elements that listen to it // can update their size this.fire('resize', {}, window);