Only show "Edit sketch" button when code pane is focused with sketch selected (#5691)
* Only show "Edit sketch" button when code pane is focused with sketch selected Closes #4273. WIP until tests are updated, since this will impact many that look for the "Edit sketch" button. * Start removing "edit sketch" point-and-click from E2E * Update more E2E tests * Update more tests that assumed Edit Sketch button * A snapshot a day keeps the bugs away! 📷🐛 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -20,6 +20,7 @@ export interface ToolbarItemCallbackProps {
|
||||
modelingState: StateFrom<typeof modelingMachine>
|
||||
modelingSend: (event: EventFrom<typeof modelingMachine>) => void
|
||||
sketchPathId: string | false
|
||||
editorHasFocus: boolean | undefined
|
||||
}
|
||||
|
||||
export type ToolbarItem = {
|
||||
@ -65,8 +66,8 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
|
||||
items: [
|
||||
{
|
||||
id: 'sketch',
|
||||
onClick: ({ modelingSend, sketchPathId }) =>
|
||||
!sketchPathId
|
||||
onClick: ({ modelingSend, sketchPathId, editorHasFocus }) =>
|
||||
!(editorHasFocus && sketchPathId)
|
||||
? modelingSend({
|
||||
type: 'Enter sketch',
|
||||
data: { forceNewSketch: true },
|
||||
@ -74,8 +75,8 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
|
||||
: modelingSend({ type: 'Enter sketch' }),
|
||||
icon: 'sketch',
|
||||
status: 'available',
|
||||
title: ({ sketchPathId }) =>
|
||||
sketchPathId ? 'Edit Sketch' : 'Start Sketch',
|
||||
title: ({ editorHasFocus, sketchPathId }) =>
|
||||
editorHasFocus && sketchPathId ? 'Edit Sketch' : 'Start Sketch',
|
||||
showTitle: true,
|
||||
hotkey: 'S',
|
||||
description: 'Start drawing a 2D sketch',
|
||||
|
Reference in New Issue
Block a user