fix: Codify component weights with toolbox in front of flyouts. (#8432)

This commit is contained in:
John Nesky
2024-07-29 10:30:29 -07:00
committed by GitHub
parent 0f74186227
commit e2310a4fed
5 changed files with 16 additions and 4 deletions

View File

@@ -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;

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;