chore: rearrange tools

This commit is contained in:
Konstantinos Kaloutas
2022-12-08 17:26:53 +02:00
parent 4708e6067d
commit 790fe928c9
12 changed files with 18 additions and 19 deletions

View File

@@ -81,7 +81,7 @@ test('set whiteboard title', async ({ page }) => {
})
test('select rectangle tool', async ({ page }) => {
await page.keyboard.press('7')
await page.keyboard.press('r')
await expect(
page.locator('.tl-geometry-tools-pane-anchor [title*="Rectangle"]')
).toHaveAttribute('data-selected', 'true')
@@ -91,7 +91,7 @@ test('draw a rectangle', async ({ page }) => {
const canvas = await page.waitForSelector('.logseq-tldraw')
const bounds = (await canvas.boundingBox())!
await page.keyboard.press('7')
await page.keyboard.press('r')
await page.mouse.move(bounds.x + 5, bounds.y + 5)
await page.mouse.down()

View File

@@ -31,13 +31,6 @@ export const ActionBar = observer(function ActionBar(): JSX.Element {
return (
<div className="tl-action-bar">
<div className="tl-toolbar tl-history-bar">
<ToolButton title="Select" id="select" icon="select-cursor" />
<ToolButton
title="Move"
id="move"
icon={app.isIn('move.panning') ? 'hand-grab' : 'hand-stop'}
/>
<Separator.Root className="tl-toolbar-separator" orientation="vertical" />
<Button title="Undo" onClick={undo}>
<TablerIcon name="arrow-back-up" />
</Button>

View File

@@ -16,8 +16,14 @@ export const PrimaryTools = observer(function PrimaryTools() {
return (
<div className="tl-primary-tools">
<div className="tl-toolbar tl-tools-floating-panel">
<ToolButton title="Add block or page" id="logseq-portal" icon="circle-plus" />
<ToolButton title="Select" id="select" icon="select-cursor" />
<ToolButton
title="Move"
id="move"
icon={app.isIn('move.panning') ? 'hand-grab' : 'hand-stop'}
/>
<Separator.Root className="tl-toolbar-separator" orientation="horizontal" />
<ToolButton title="Add block or page" id="logseq-portal" icon="circle-plus" />
<ToolButton title="Draw" id="pencil" icon="ballpen" />
<ToolButton title="Highlight" id="highlighter" icon="highlight" />
<ToolButton title="Eraser" id="erase" icon="eraser" />

View File

@@ -4,6 +4,6 @@ import { BoxShape, type Shape } from '../shapes'
export class BoxTool extends TLBoxTool<BoxShape, Shape, TLReactEventMap> {
static id = 'box'
static shortcut = ['7', 'r']
static shortcut = ['9', 'r']
Shape = BoxShape
}

View File

@@ -4,5 +4,5 @@ import type { Shape } from '../shapes'
export class NuEraseTool extends TLEraseTool<Shape, TLReactEventMap> {
static id = 'erase'
static shortcut = ['4', 'e']
static shortcut = ['6', 'e']
}

View File

@@ -4,7 +4,7 @@ import { HighlighterShape, type Shape } from '../shapes'
export class HighlighterTool extends TLDrawTool<HighlighterShape, Shape, TLReactEventMap> {
static id = 'highlighter'
static shortcut = ['3', 'h']
static shortcut = ['5', 'h']
Shape = HighlighterShape
simplify = true
simplifyTolerance = 0.618

View File

@@ -5,6 +5,6 @@ import { LineShape, type Shape } from '../shapes'
// @ts-expect-error maybe later
export class LineTool extends TLLineTool<LineShape, Shape, TLReactEventMap> {
static id = 'line'
static shortcut = ['5', 'c']
static shortcut = ['7', 'c']
Shape = LineShape
}

View File

@@ -9,7 +9,7 @@ export class LogseqPortalTool extends TLTool<
TLApp<Shape, TLReactEventMap>
> {
static id = 'logseq-portal'
static shortcut = ['1']
static shortcut = ['3']
static states = [IdleState, CreatingState]
static initial = 'idle'

View File

@@ -4,7 +4,7 @@ import { PencilShape, type Shape } from '../shapes'
export class PencilTool extends TLDrawTool<PencilShape, Shape, TLReactEventMap> {
static id = 'pencil'
static shortcut = ['2', 'd']
static shortcut = ['4', 'd']
Shape = PencilShape
simplify = false
}

View File

@@ -4,6 +4,6 @@ import { TextShape, type Shape } from '../shapes'
export class TextTool extends TLTextTool<TextShape, Shape, TLReactEventMap> {
static id = 'text'
static shortcut = ['6', 't']
static shortcut = ['8', 't']
Shape = TextShape
}

View File

@@ -10,7 +10,7 @@ export class TLMoveTool<
R extends TLApp<S, K> = TLApp<S, K>
> extends TLTool<S, K, R> {
static id = 'move'
static shortcut = ['m', '9']
static shortcut = ['m', '2']
static states = [IdleState, IdleHoldState, PanningState, PinchingState]

View File

@@ -33,7 +33,7 @@ export class TLSelectTool<
static initial = 'idle'
static shortcut = ['s', '8']
static shortcut = ['s', '1']
static states = [
IdleState,