Skip to content

Commit

Permalink
fix: miscellaneous UI fixits (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored Apr 24, 2024
1 parent 4e794f6 commit 300a1ce
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
22 changes: 15 additions & 7 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@ const styles = `
stroke: #c6c6c6;
}
.blocklyFlyoutButton .blocklyText {
fill: var(--colour-textFieldText);
}
.blocklyFlyoutButtonShadow {
fill: transparent;
}
Expand Down Expand Up @@ -416,6 +412,14 @@ const styles = `
font-weight: bold;
}
.zelos-renderer.scratch-theme .blocklyText {
font-weight: 500;
}
.zelos-renderer.scratch-theme .blocklyFlyoutButton .blocklyText {
fill: var(--colour-textFieldText);
}
/*
Don't allow users to select text. It gets annoying when trying to
drag a block and selected text moves instead.
Expand Down Expand Up @@ -749,7 +753,7 @@ const styles = `
outline: none;
}
.blocklyTreeRow {
.blocklyToolboxDiv .blocklyTreeRow {
line-height: 22px;
margin: 0;
padding: 0.375rem 0px;
Expand Down Expand Up @@ -933,6 +937,12 @@ const styles = `
overflow-y: auto;
overflow-x: hidden;
z-index: 20000; /* Arbitrary, but some apps depend on it... */
box-sizing: content-box;
box-shadow: none;
}
.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
box-shadow: none;
}
.blocklyDropDownDiv .goog-menu {
Expand Down Expand Up @@ -972,7 +982,6 @@ const styles = `
* #noflip to .goog-menuitem.
*/
.blocklyWidgetDiv .goog-menuitem {
color: #000;
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
list-style: none;
margin: 0;
Expand Down Expand Up @@ -1021,7 +1030,6 @@ const styles = `
.blocklyWidgetDiv .goog-menuitem-content ,
.blocklyDropDownDiv .goog-menuitem-content {
color: #000;
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
}
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
ContinuousMetrics,
} from '@blockly/continuous-toolbox';

import './scratch_continuous_category.js';

export * from 'blockly';
export * from './categories.js';
export * from './procedures.js';
Expand All @@ -45,5 +47,7 @@ export function inject(container, options) {
}

Blockly.Scrollbar.scrollbarThickness = Blockly.Touch.TOUCH_ENABLED ? 14 : 11;
Blockly.FlyoutButton.TEXT_MARGIN_X = 40;
Blockly.FlyoutButton.TEXT_MARGIN_Y = 10;
Blockly.ContextMenuRegistry.registry.unregister('blockDisable');
Blockly.ContextMenuRegistry.registry.unregister('blockInline');
23 changes: 23 additions & 0 deletions src/scratch_continuous_category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as Blockly from 'blockly/core';
import {ContinuousCategory} from '@blockly/continuous-toolbox';

class ScratchContinuousCategory extends ContinuousCategory {
createIconDom_() {
const icon = super.createIconDom_();
icon.style.border = `1px solid ${this.toolboxItemDef_['secondaryColour']}`;
return icon;
}

setSelected(isSelected) {
super.setSelected(isSelected);
// Prevent hardcoding the background color to grey.
this.rowDiv_.style.backgroundColor = '';
}
}

Blockly.registry.register(
Blockly.registry.Type.TOOLBOX_ITEM,
Blockly.ToolboxCategory.registrationName,
ScratchContinuousCategory,
true,
);

0 comments on commit 300a1ce

Please sign in to comment.