Skip to content

Commit

Permalink
fix: modernize and reenable the colour slider field
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko committed Apr 24, 2024
1 parent 300a1ce commit f4d85ac
Show file tree
Hide file tree
Showing 5 changed files with 375 additions and 330 deletions.
11 changes: 3 additions & 8 deletions blocks_common/colour.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
* @fileoverview Colour blocks for Blockly.
* @author [email protected] (Neil Fraser)
*/
'use strict';

goog.provide('Blockly.Blocks.colour');

goog.require('Blockly.Blocks');

goog.require('Blockly.constants');
import * as Blockly from 'blockly';
import * as Constants from '../src/constants.js';

/**
* Pick a random colour.
Expand All @@ -54,7 +49,7 @@ Blockly.Blocks['colour_picker'] = {
"colour": randomColour()
}
],
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
"outputShape": Constants.OUTPUT_SHAPE_ROUND,
"output": "Colour"
});
}
Expand Down
34 changes: 34 additions & 0 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,10 @@ const styles = `
cursor: pointer;
}
.scratchColourPicker {
width: min-content;
}
.scratchColourPickerLabel {
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-size: 0.65rem;
Expand All @@ -896,6 +900,36 @@ const styles = `
margin-left: 10px;
}
.scratchColourSlider {
appearance: none;
margin: 8px;
height: 22px;
width: 150px;
position: relative;
outline: none;
border-radius: 11px;
margin-bottom: 20px;
}
/* Combining this and the -moz equivalent below with a comma break the webkit version */
.scratchColourSlider::-webkit-slider-thumb {
appearance: none;
background-color: #fff;
height: 26px;
width: 26px;
border-radius: 100%;
box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);
}
.scratchColourSlider::-moz-range-thumb {
appearance: none;
background-color: #fff;
height: 26px;
width: 26px;
border-radius: 100%;
box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);
}
.scratchMatrixButtonDiv {
width: 50%;
text-align: center;
Expand Down
Loading

0 comments on commit f4d85ac

Please sign in to comment.