Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion webapp/src/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,10 @@ export class Editor extends toolboxeditor.ToolboxEditor {
}
}

public isFlyoutVisible(): boolean {
return !!this.editor?.getFlyout()?.isVisible();
}

///////////////////////////////////////////////////////////
//////////// Toolbox methods /////////////
///////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2862,4 +2866,4 @@ function getBlockConfigXml(block: toolbox.BlockDefinition, blockConfig: pxt.tuto
return xml;
}
return undefined;
}
}
4 changes: 4 additions & 0 deletions webapp/src/monaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,10 @@ export class Editor extends toolboxeditor.ToolboxEditor {
this.parent.setState({ hideEditorFloats: false });
}

public isFlyoutVisible(): boolean {
return !!this.flyout?.state?.groups && !this.flyout?.state?.hide;
}

updateToolbox() {
let appTheme = pxt.appTarget.appTheme;
if (!appTheme.monacoToolbox || pxt.shell.isReadOnly() || !this.editor) return;
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/toolbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ export class Toolbox extends data.Component<ToolboxProps, ToolboxState> {

let id = subns ? nameid + subns : nameid;

if (this.state.selectedItem == id && !force && !onlyTriggerOnClick) {
if (this.state.selectedItem === id && !force && !onlyTriggerOnClick
&& (!pxt.BrowserUtils.isTouchEnabled() || parent.isFlyoutVisible())) {
this.clearSelection();

// Hide flyout
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/toolboxeditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export abstract class ToolboxEditor extends srceditor.Editor {
abstract showFlyout(treeRow: toolbox.ToolboxCategory): void;
abstract hideFlyout(): void;
abstract setFlyoutForceOpen(forceOpen: boolean): void;
abstract isFlyoutVisible(): boolean;
moveFocusToFlyout() { }

protected abstract showFlyoutHeadingLabel(ns: string, name: string, subns: string, icon: string, color: string): void;
Expand Down Expand Up @@ -429,4 +430,4 @@ export abstract class ToolboxEditor extends srceditor.Editor {

function shouldHideCategory(category: string, filters: {[index: string]: pxt.editor.FilterState}): boolean {
return filters[category] == pxt.editor.FilterState.Hidden || filters[category] == pxt.editor.FilterState.Disabled;
}
}