File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1275,6 +1275,12 @@ const styles = `
1275
1275
.scratchCategoryMenuItem:hover {
1276
1276
color: $colour_toolboxHover !important;
1277
1277
}
1278
+
1279
+ .categoryIconBubble {
1280
+ margin: 0 auto 0.125rem;
1281
+ width: 1.25rem;
1282
+ height: 1.25rem;
1283
+ }
1278
1284
` ;
1279
1285
1280
1286
Blockly . Css . register ( styles ) ;
Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import {ContinuousCategory} from '@blockly/continuous-toolbox';
3
3
4
4
class ScratchContinuousCategory extends ContinuousCategory {
5
5
createIconDom_ ( ) {
6
- const icon = super . createIconDom_ ( ) ;
7
- icon . style . border = `1px solid ${ this . toolboxItemDef_ [ 'secondaryColour' ] } ` ;
8
- return icon ;
6
+ if ( this . toolboxItemDef_ . iconURI ) {
7
+ const icon = document . createElement ( 'img' ) ;
8
+ icon . src = this . toolboxItemDef_ . iconURI ;
9
+ icon . className = 'categoryIconBubble' ;
10
+ return icon ;
11
+ } else {
12
+ const icon = super . createIconDom_ ( ) ;
13
+ icon . style . border = `1px solid ${ this . toolboxItemDef_ [ 'secondaryColour' ] } ` ;
14
+ return icon ;
15
+ }
9
16
}
10
-
17
+
11
18
setSelected ( isSelected ) {
12
19
super . setSelected ( isSelected ) ;
13
20
// Prevent hardcoding the background color to grey.
You can’t perform that action at this time.
0 commit comments