Signed-off-by: onekiloparsec <cedric@onekilopars.ec>
This commit is contained in:
onekiloparsec
2017-07-06 15:19:59 +02:00
parent faee879987
commit a0e5ee35d1

View File

@@ -96,7 +96,7 @@
default: [Number, String], default: [Number, String],
validator (value) { validator (value) {
if (typeof value === 'string') { if (typeof value === 'string') {
return this.isPercentage(value) return string.splice(-1) === '%' && !isNaN(parseFloat(string))
} }
if (typeof value === 'number') { if (typeof value === 'number') {
@@ -110,7 +110,7 @@
validator (value) { validator (value) {
if (typeof value === 'string') { if (typeof value === 'string') {
const reg = RegExp('^(\d+|\d+[.]\d+)%?$') const reg = RegExp('^(\d+|\d+[.]\d+)%?$')
return value === 'auto' || this.isPercentage(value) return value === 'auto' || (string.splice(-1) === '%' && !isNaN(parseFloat(string)))
} }
if (typeof value === 'number') { if (typeof value === 'number') {
@@ -278,10 +278,6 @@
return (typeof modal.height === 'string') ? window.height * parseFloat(modal.height) / 100.0 : modal.height return (typeof modal.height === 'string') ? window.height * parseFloat(modal.height) / 100.0 : modal.height
}, },
isPercentage (string) {
return string.splice(-1) === '%' && !isNaN(parseFloat(string))
},
resize (event) { resize (event) {
this.modal.width = event.size.width this.modal.width = event.size.width
this.modal.height = event.size.height this.modal.height = event.size.height