Mercurial > code > home > repos > light9
changeset 1613:b0ea577c12a3
WIP colorpick into timeline. working on initial-paint bugs
Ignore-this: 497c157da0ff57cc6f5a66eba254e30c
author | drewp@bigasterisk.com |
---|---|
date | Wed, 07 Jun 2017 04:32:10 +0000 |
parents | 97e4f1b5ff19 |
children | 8753dd9e6bd1 |
files | light9/web/light9-color-picker.html light9/web/timeline/timeline-elements.html light9/web/timeline/timeline.coffee |
diffstat | 3 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/light9-color-picker.html Tue Jun 06 06:37:09 2017 +0000 +++ b/light9/web/light9-color-picker.html Wed Jun 07 04:32:10 2017 +0000 @@ -1,4 +1,5 @@ <link rel="import" href="/lib/polymer/polymer.html"> +<link rel="import" href="/lib/paper-slider/paper-slider.html"> <dom-module id="light9-color-picker"> <template> @@ -75,7 +76,7 @@ <script src="/lib/color/one-color.js"></script> <script> class RainbowCanvas { - constructor(url, size) { + constructor(url, size, onReady) { this.size = size; var elem = document.createElement('canvas'); elem.width = size[0]; @@ -89,6 +90,7 @@ img.onload = function() { this.ctx.drawImage(img, 0, 0); this._readImage(); + if (onReady) onReady(); }.bind(this); img.src = url; } @@ -165,7 +167,11 @@ large: new RainbowCanvas( '/colorpick_rainbow_large.png', [400, 200]), small: new RainbowCanvas( - '/colorpick_rainbow_small.png', [150, 30]), + '/colorpick_rainbow_small.png', [150, 30], + function() { + // color may have been set before our image came + this.readColor(this.color); + }.bind(this)), }; } this.large = window.pickerCanvases.large; @@ -184,15 +190,18 @@ return; } + console.log('pos', color) // setting immediate-value doesn't work - this.sliderWriteValue = one.color(color).value() * 255; - + var colorValue = one.color(color).value() * 255; + this.sliderWriteValue = colorValue; try { var pos = this.small.posFor(color); } catch(e) { + console.log('err') this.moveSmallCrosshair([-999, -999]); return; } + console.log('go', pos) this.moveSmallCrosshair(pos); }, _floatLarge: function() {
--- a/light9/web/timeline/timeline-elements.html Tue Jun 06 06:37:09 2017 +0000 +++ b/light9/web/timeline/timeline-elements.html Wed Jun 07 04:32:10 2017 +0000 @@ -4,6 +4,7 @@ <link rel="import" href="light9-timeline-audio.html"> <link rel="import" href="../rdfdb-synced-graph.html"> <link rel="import" href="../light9-music.html"> +<link rel="import" href="../light9-color-picker.html"> <link rel="import" href="../edit-choice.html"> @@ -333,9 +334,7 @@ <table> <tr><th>effect:</th><td><edit-choice uri="{{effect}}" label="{{effectLabel}}"></edit-choice></td></tr> <tr><th>colorScale:</th><td> - <!-- this could share with live/index.html's - light9-live-control, but that one is currently junky --> - <span><input type="color" value="{{colorScale::input}}"></span> + <light9-color-picker color="{{colorScale}}"></light9-color-picker> </td></tr> </table> </div>
--- a/light9/web/timeline/timeline.coffee Tue Jun 06 06:37:09 2017 +0000 +++ b/light9/web/timeline/timeline.coffee Wed Jun 07 04:32:10 2017 +0000 @@ -502,7 +502,7 @@ rightX = screenPts[Math.min(2, screenPts.length - 1)].e(1) - 5 if screenPts.length < 3 rightX = leftX + 120 - w = 150 + w = 430 h = 80 @inlineRect = { left: leftX,