From 97834aeb9193ea1d3b9ab09fda0b8061b9b48ef5 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 12 Dec 2016 15:59:52 +0100 Subject: [PATCH] canvas input: clean && apply last commit's spirit --- src/browser/js/jquery/jquery.fake-input.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/browser/js/jquery/jquery.fake-input.js b/src/browser/js/jquery/jquery.fake-input.js index 51c23439..1c3f99c6 100644 --- a/src/browser/js/jquery/jquery.fake-input.js +++ b/src/browser/js/jquery/jquery.fake-input.js @@ -14,22 +14,26 @@ self.width = undefined self.color = undefined self.center = settings.align == 'center' + self.visible = false self.attr('tabindex',"0") - canvas.resize(function(e,width,height){ + canvas.resize(function(e,width,height,checkColors){ var width = width*2, height = height*2 - if (height==100 && width==100 || !width) return + if (width && height) { + self.height=height + self.width=width - self.color = getComputedStyle(canvas[0]).getPropertyValue("--color-text") - self.height=height - self.width=width + canvas[0].setAttribute('width',width) + canvas[0].setAttribute('height',height) + } - canvas[0].setAttribute('width',width) - canvas[0].setAttribute('height',height) + if (!self.visible || checkColors) { + self.color = getComputedStyle(canvas[0]).getPropertyValue("--color-text") + } self.val(self.value) })