Fixed bug related to locked tools & select tool (#331)

pull/335/head
Proful Sadangi 2021-11-21 22:53:13 +11:00 zatwierdzone przez GitHub
rodzic 3f674d7fa5
commit a1f4149efe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -87,6 +87,7 @@ export const PrimaryTools = React.memo(function PrimaryTools(): JSX.Element {
kbd={'7'}
label={TDShapeType.Text}
onClick={selectTextTool}
isLocked={isToolLocked}
isActive={activeTool === TDShapeType.Text}
>
<TextIcon />

Wyświetl plik

@ -1839,9 +1839,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
this.addToSelectHistory(this.selectedIds)
if (this.appState.activeTool !== 'select') {
this.selectTool('select')
}
this.selectTool('select')
return this
}
@ -2730,6 +2728,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
if (Date.now() - this.editingStartTime < 50) return
const { editingId } = this.pageState
const { isToolLocked } = this.getAppState()
if (editingId) {
// If we're editing text, then delete the text if it's empty
@ -2738,7 +2737,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
if (shape.type === TDShapeType.Text) {
if (shape.text.trim().length <= 0) {
this.patchState(Commands.deleteShapes(this, [editingId]).after, 'delete_empty_text')
} else {
} else if (!isToolLocked) {
this.select(editingId)
}
}