From 90e07768427d1b774285de43a63fb470faf0869e Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Tue, 2 Sep 2014 13:13:35 -0400 Subject: [PATCH] cross-browser frustration --- build/gui.html | 105 +++++++++++------- demo.html | 2 - .../controller-boolean.html | 12 +- .../controller-boolean/controller-boolean.js | 13 +-- .../controller-boolean.styl | 48 ++++++-- .../controller-number/controller-number.styl | 16 ++- .../controller-string/controller-string.styl | 4 +- elements/gui-panel/gui-panel.js | 16 +-- elements/gui-row/gui-row.styl | 2 +- elements/shared.styl | 14 +-- examples/index.html | 4 +- gulpfile.js | 13 ++- 12 files changed, 157 insertions(+), 92 deletions(-) diff --git a/build/gui.html b/build/gui.html index ec856da..dd1c73a 100644 --- a/build/gui.html +++ b/build/gui.html @@ -488,7 +488,6 @@ if(f)g=void 0;else if(f=g[this.name],!f)return void console.error("Cannot find f overflow: hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; - word-wrap: break-word; } #comment { line-height: 16px; @@ -705,7 +704,7 @@ Polymer('gui-panel', { this.anon.values = {}; - window.addEventListener( 'resize', this.checkHeight.bind( this ) ); + // window.addEventListener( 'resize', this.checkHeight.bind( this ) ); }, @@ -810,15 +809,15 @@ Polymer('gui-panel', { this.open = !this.open; }, - checkHeight: function() { + // checkHeight: function() { - if ( window.innerHeight < this.$.controllers.offsetHeight ) { - this.docked = true; - } else { - this.docked = false; - } + // if ( window.innerHeight < this.$.controllers.offsetHeight ) { + // this.docked = true; + // } else { + // this.docked = false; + // } - }, + // }, // Legacy @@ -1211,6 +1210,7 @@ Polymer( 'controller-number', { } #track-container { height: 100%; + padding: 0 8px; } #track { width: 100%; @@ -1263,16 +1263,14 @@ Polymer( 'controller-number', { } input { font: 10px 'Lucida Grande', sans-serif; - color: #eee; + color: #25a0d8; -webkit-font-smoothing: antialiased; - color: text-color; height: 100%; display: inline-block; background: transparent; border: 0; padding: 0; outline: none; - padding-left: 8px; -webkit-transition: background-color 0.15s linear; -moz-transition: background-color 0.15s linear; -o-transition: background-color 0.15s linear; @@ -1288,7 +1286,6 @@ input:focus { } .slider-true input { text-align: center; - margin-left: 8px; width: 25%; -webkit-transition: width 0.2s cubic-bezier(0.25, 0.25, 0, 1); -moz-transition: width 0.2s cubic-bezier(0.25, 0.25, 0, 1); @@ -1304,10 +1301,11 @@ input:focus { width: 50%; } .slider-false input { + padding-left: 8px; width: 100%; } input::selection { - background-color: #25a0d8; + background-color: rgba(255,255,255,0.25); } @@ -1354,16 +1352,14 @@ Polymer( 'controller-string', { } input { font: 10px 'Lucida Grande', sans-serif; - color: #eee; + color: #1ebd6e; -webkit-font-smoothing: antialiased; - color: text-color; height: 100%; display: inline-block; background: transparent; border: 0; padding: 0; outline: none; - padding-left: 8px; -webkit-transition: background-color 0.15s linear; -moz-transition: background-color 0.15s linear; -o-transition: background-color 0.15s linear; @@ -1374,7 +1370,7 @@ input { box-sizing: border-box; width: 100%; height: 100%; - color: #1ebd6e; + padding-left: 8px; } input:hover, input:focus { @@ -1403,21 +1399,16 @@ Polymer( 'controller-boolean', { }, - change: function() { - - this.value = this.$.input.checked; + toggle: function() { - }, - - update: function() { - - // should i really have to do this? - this.$.input.checked = this.value; + console.log( 'hi' ); + this.value = !this.value; } + }); @@ -1426,22 +1417,60 @@ Polymer( 'controller-boolean', { diff --git a/demo.html b/demo.html index 83b8655..38125ad 100644 --- a/demo.html +++ b/demo.html @@ -8,8 +8,6 @@ - - diff --git a/elements/controller-boolean/controller-boolean.html b/elements/controller-boolean/controller-boolean.html index d9705ee..3e08b50 100644 --- a/elements/controller-boolean/controller-boolean.html +++ b/elements/controller-boolean/controller-boolean.html @@ -9,9 +9,15 @@ - +
+ +
+
+
+ + + +
diff --git a/elements/controller-boolean/controller-boolean.js b/elements/controller-boolean/controller-boolean.js index 5d3a1c4..1f053f6 100644 --- a/elements/controller-boolean/controller-boolean.js +++ b/elements/controller-boolean/controller-boolean.js @@ -11,20 +11,15 @@ Polymer( 'controller-boolean', { }, - change: function() { - - this.value = this.$.input.checked; + toggle: function() { - }, - - update: function() { - - // should i really have to do this? - this.$.input.checked = this.value; + console.log( 'hi' ); + this.value = !this.value; } + }); diff --git a/elements/controller-boolean/controller-boolean.styl b/elements/controller-boolean/controller-boolean.styl index 6cbc3e4..e5b7966 100644 --- a/elements/controller-boolean/controller-boolean.styl +++ b/elements/controller-boolean/controller-boolean.styl @@ -1,15 +1,47 @@ @import '../shared'; -#container, #input { - cursor: pointer; -} +height = 8px; +width = round( height * 2.5 ); +border-radius = height; #container { - display: block; height: 100%; - // border: 1px solid red; + cursor: pointer; + padding-left: padding +} + +#switch-track { + width: width; + height: height; + background: light; + border-radius: border-radius; + transition: background 0.1s linear; +} + +#switch-knob { + height: height; + width: height; + border-radius: border-radius; + background: white; + transition: transform 0.15s ease; +} + +.value-true { + #switch-track { + background: boolean-color; + } + #switch-knob { + transform: translate3d( width - height, 0, 0 ); + } +} + +#text { + margin-left: padding; + .value-true & { + // color: boolean-color; + } + .value-false & { + color: light; + } } -#input { - // margin-top: 20px; -} \ No newline at end of file diff --git a/elements/controller-number/controller-number.styl b/elements/controller-number/controller-number.styl index a70234a..3ae9652 100644 --- a/elements/controller-number/controller-number.styl +++ b/elements/controller-number/controller-number.styl @@ -1,8 +1,5 @@ @import '../shared'; -fill-color = number-color -track-color = light - track-size = 1px; fill-size = 1px; knob-size = 6px @@ -13,6 +10,7 @@ knob-size = 6px #track-container { height: 100%; + padding: 0 padding; } #track { @@ -21,7 +19,7 @@ knob-size = 6px border-radius: track-size; display: inline-block; position: relative; - background: track-color; + background: light; } #fill { @@ -30,7 +28,7 @@ knob-size = 6px margin-left: 1px; border-radius: fill-size; position: absolute; - background: fill-color; + background: number-color; pointer-events: none; } @@ -48,7 +46,7 @@ knob-size = 6px pointer-events: none; position: absolute; - background-color: fill-color; + background-color: number-color; border-radius: 100%; } @@ -71,12 +69,11 @@ knob-size = 6px input { - input() + input( number-color ); .slider-true & { text-align: center; - margin-left: padding; width: 25%; transition: width 0.2s ease; padding: 0; @@ -95,11 +92,12 @@ input { .slider-false & { // border-bottom: 1px solid number-color; + padding-left: padding width: 100%; } } input::selection { - background-color: number-color; + background-color: light; } diff --git a/elements/controller-string/controller-string.styl b/elements/controller-string/controller-string.styl index 2320379..65867e6 100644 --- a/elements/controller-string/controller-string.styl +++ b/elements/controller-string/controller-string.styl @@ -4,7 +4,7 @@ height: 100%; input - input(); + input( string-color ); width: 100%; height: 100%; - color: string-color; \ No newline at end of file + padding-left: padding \ No newline at end of file diff --git a/elements/gui-panel/gui-panel.js b/elements/gui-panel/gui-panel.js index 81f0fc3..afde1c4 100644 --- a/elements/gui-panel/gui-panel.js +++ b/elements/gui-panel/gui-panel.js @@ -13,7 +13,7 @@ Polymer('gui-panel', { this.anon.values = {}; - window.addEventListener( 'resize', this.checkHeight.bind( this ) ); + // window.addEventListener( 'resize', this.checkHeight.bind( this ) ); }, @@ -118,15 +118,15 @@ Polymer('gui-panel', { this.open = !this.open; }, - checkHeight: function() { + // checkHeight: function() { - if ( window.innerHeight < this.$.controllers.offsetHeight ) { - this.docked = true; - } else { - this.docked = false; - } + // if ( window.innerHeight < this.$.controllers.offsetHeight ) { + // this.docked = true; + // } else { + // this.docked = false; + // } - }, + // }, // Legacy diff --git a/elements/gui-row/gui-row.styl b/elements/gui-row/gui-row.styl index bec473b..abbd3a0 100644 --- a/elements/gui-row/gui-row.styl +++ b/elements/gui-row/gui-row.styl @@ -49,7 +49,7 @@ overflow: hidden; text-overflow: ellipsis; - word-wrap: break-word; + // word-wrap: break-word; diff --git a/elements/shared.styl b/elements/shared.styl index bb10783..93e1882 100644 --- a/elements/shared.styl +++ b/elements/shared.styl @@ -18,6 +18,7 @@ font-color = #eee panel-color = #1a1a1a number-color = #25A0D8 +boolean-color = #864694 string-color = #1EBD6E padding = 8px @@ -31,21 +32,20 @@ dark = rgba( 0, 0, 0, 0.1 ); // common -panel-font() +panel-font( color = font-color ) font: 10px 'Lucida Grande', sans-serif; - color: font-color; - -webkit-font-smoothing: antialiased; + color: color; + if ( light( color ) ) + -webkit-font-smoothing: antialiased; -input() - panel-font() - color: text-color; +input( color ) + panel-font( color ) height: 100%; display: inline-block; background: transparent; border: 0; padding: 0; outline: none; - padding-left: padding; transition: background-color 0.15s linear; box-sizing: border-box; &:hover, &:focus diff --git a/examples/index.html b/examples/index.html index 4bd59be..a0205ec 100644 --- a/examples/index.html +++ b/examples/index.html @@ -22,6 +22,7 @@