Skip to content

Commit 300a1ce

Browse files
authored
fix: miscellaneous UI fixits (#41)
1 parent 4e794f6 commit 300a1ce

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

core/css.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,6 @@ const styles = `
383383
stroke: #c6c6c6;
384384
}
385385
386-
.blocklyFlyoutButton .blocklyText {
387-
fill: var(--colour-textFieldText);
388-
}
389-
390386
.blocklyFlyoutButtonShadow {
391387
fill: transparent;
392388
}
@@ -416,6 +412,14 @@ const styles = `
416412
font-weight: bold;
417413
}
418414
415+
.zelos-renderer.scratch-theme .blocklyText {
416+
font-weight: 500;
417+
}
418+
419+
.zelos-renderer.scratch-theme .blocklyFlyoutButton .blocklyText {
420+
fill: var(--colour-textFieldText);
421+
}
422+
419423
/*
420424
Don't allow users to select text. It gets annoying when trying to
421425
drag a block and selected text moves instead.
@@ -749,7 +753,7 @@ const styles = `
749753
outline: none;
750754
}
751755
752-
.blocklyTreeRow {
756+
.blocklyToolboxDiv .blocklyTreeRow {
753757
line-height: 22px;
754758
margin: 0;
755759
padding: 0.375rem 0px;
@@ -933,6 +937,12 @@ const styles = `
933937
overflow-y: auto;
934938
overflow-x: hidden;
935939
z-index: 20000; /* Arbitrary, but some apps depend on it... */
940+
box-sizing: content-box;
941+
box-shadow: none;
942+
}
943+
944+
.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
945+
box-shadow: none;
936946
}
937947
938948
.blocklyDropDownDiv .goog-menu {
@@ -972,7 +982,6 @@ const styles = `
972982
* #noflip to .goog-menuitem.
973983
*/
974984
.blocklyWidgetDiv .goog-menuitem {
975-
color: #000;
976985
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
977986
list-style: none;
978987
margin: 0;
@@ -1021,7 +1030,6 @@ const styles = `
10211030
10221031
.blocklyWidgetDiv .goog-menuitem-content ,
10231032
.blocklyDropDownDiv .goog-menuitem-content {
1024-
color: #000;
10251033
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
10261034
}
10271035

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
ContinuousMetrics,
2626
} from '@blockly/continuous-toolbox';
2727

28+
import './scratch_continuous_category.js';
29+
2830
export * from 'blockly';
2931
export * from './categories.js';
3032
export * from './procedures.js';
@@ -45,5 +47,7 @@ export function inject(container, options) {
4547
}
4648

4749
Blockly.Scrollbar.scrollbarThickness = Blockly.Touch.TOUCH_ENABLED ? 14 : 11;
50+
Blockly.FlyoutButton.TEXT_MARGIN_X = 40;
51+
Blockly.FlyoutButton.TEXT_MARGIN_Y = 10;
4852
Blockly.ContextMenuRegistry.registry.unregister('blockDisable');
4953
Blockly.ContextMenuRegistry.registry.unregister('blockInline');

src/scratch_continuous_category.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as Blockly from 'blockly/core';
2+
import {ContinuousCategory} from '@blockly/continuous-toolbox';
3+
4+
class ScratchContinuousCategory extends ContinuousCategory {
5+
createIconDom_() {
6+
const icon = super.createIconDom_();
7+
icon.style.border = `1px solid ${this.toolboxItemDef_['secondaryColour']}`;
8+
return icon;
9+
}
10+
11+
setSelected(isSelected) {
12+
super.setSelected(isSelected);
13+
// Prevent hardcoding the background color to grey.
14+
this.rowDiv_.style.backgroundColor = '';
15+
}
16+
}
17+
18+
Blockly.registry.register(
19+
Blockly.registry.Type.TOOLBOX_ITEM,
20+
Blockly.ToolboxCategory.registrationName,
21+
ScratchContinuousCategory,
22+
true,
23+
);

0 commit comments

Comments
 (0)