mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
fix: Codify component weights with toolbox in front of flyouts. (#8432)
This commit is contained in:
@@ -224,6 +224,16 @@ export class ComponentManager {
|
||||
}
|
||||
|
||||
export namespace ComponentManager {
|
||||
export enum ComponentWeight {
|
||||
// The toolbox weight is lower (higher precedence) than the flyout, so that
|
||||
// if both are under the pointer, the toolbox takes precedence even though
|
||||
// the flyout's drag target area is large enough to include the toolbox.
|
||||
TOOLBOX_WEIGHT = 0,
|
||||
FLYOUT_WEIGHT = 1,
|
||||
TRASHCAN_WEIGHT = 2,
|
||||
ZOOM_CONTROLS_WEIGHT = 3,
|
||||
}
|
||||
|
||||
/** An object storing component information. */
|
||||
export interface ComponentDatum {
|
||||
component: IComponent;
|
||||
@@ -232,4 +242,6 @@ export namespace ComponentManager {
|
||||
}
|
||||
}
|
||||
|
||||
export type ComponentWeight = ComponentManager.ComponentWeight;
|
||||
export const ComponentWeight = ComponentManager.ComponentWeight;
|
||||
export type ComponentDatum = ComponentManager.ComponentDatum;
|
||||
|
||||
@@ -427,7 +427,7 @@ export abstract class Flyout
|
||||
|
||||
targetWorkspace.getComponentManager().addComponent({
|
||||
component: this,
|
||||
weight: 1,
|
||||
weight: ComponentManager.ComponentWeight.FLYOUT_WEIGHT,
|
||||
capabilities: [
|
||||
ComponentManager.Capability.AUTOHIDEABLE,
|
||||
ComponentManager.Capability.DELETE_AREA,
|
||||
|
||||
@@ -157,7 +157,7 @@ export class Toolbox
|
||||
themeManager.subscribe(this.HtmlDiv, 'toolboxForegroundColour', 'color');
|
||||
this.workspace_.getComponentManager().addComponent({
|
||||
component: this,
|
||||
weight: 1,
|
||||
weight: ComponentManager.ComponentWeight.TOOLBOX_WEIGHT,
|
||||
capabilities: [
|
||||
ComponentManager.Capability.AUTOHIDEABLE,
|
||||
ComponentManager.Capability.DELETE_AREA,
|
||||
|
||||
@@ -247,7 +247,7 @@ export class Trashcan
|
||||
}
|
||||
this.workspace.getComponentManager().addComponent({
|
||||
component: this,
|
||||
weight: 1,
|
||||
weight: ComponentManager.ComponentWeight.TRASHCAN_WEIGHT,
|
||||
capabilities: [
|
||||
ComponentManager.Capability.AUTOHIDEABLE,
|
||||
ComponentManager.Capability.DELETE_AREA,
|
||||
|
||||
@@ -116,7 +116,7 @@ export class ZoomControls implements IPositionable {
|
||||
init() {
|
||||
this.workspace.getComponentManager().addComponent({
|
||||
component: this,
|
||||
weight: 2,
|
||||
weight: ComponentManager.ComponentWeight.ZOOM_CONTROLS_WEIGHT,
|
||||
capabilities: [ComponentManager.Capability.POSITIONABLE],
|
||||
});
|
||||
this.initialized = true;
|
||||
|
||||
Reference in New Issue
Block a user