enter in color picker now sets the color
This commit is contained in:
@@ -63,6 +63,7 @@ class ColorPicker extends HTMLElement {
|
||||
.rgba-display-wrapper {
|
||||
height: 100%;
|
||||
padding: 1.25em;
|
||||
text-align: center;
|
||||
}
|
||||
#rgba-display {
|
||||
font-family: "Courier New", monospace;
|
||||
@@ -72,11 +73,11 @@ class ColorPicker extends HTMLElement {
|
||||
display: inline;
|
||||
border: none;
|
||||
border-radius: 0.2em;
|
||||
margin-bottom: 2.5em;
|
||||
letter-spacing: 0.1em;
|
||||
width: 8em;
|
||||
width: 5em;
|
||||
max-width: 100%;
|
||||
font-variant-numeric: tabular-nums;
|
||||
text-align: center;
|
||||
}
|
||||
input[type=range] {
|
||||
width: 100%;
|
||||
@@ -132,13 +133,17 @@ class ColorPicker extends HTMLElement {
|
||||
this.lightnessInput = this.shadowRoot.getElementById( 'lightness' );
|
||||
this.colorPreview = this.shadowRoot.getElementById( 'color-preview' );
|
||||
this.rgbaDisplay = this.shadowRoot.getElementById( 'rgba-display' );
|
||||
this.rgbaDisplay.onkeyup = (event) => {
|
||||
if(event.keyCode === 13) {
|
||||
this.setColor( this.rgbaDisplay.value );
|
||||
}
|
||||
}
|
||||
|
||||
// Create a temporary canvas to read color values.
|
||||
let tempCanvas = document.createElement( 'canvas' );
|
||||
tempCanvas.height = 1;
|
||||
tempCanvas.width = 1;
|
||||
this.tempCanvasCTX = tempCanvas.getContext( '2d', { willReadFrequently: true } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user