Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement thinning #33

Merged
merged 3 commits into from
Sep 16, 2021
Merged
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
5 changes: 2 additions & 3 deletions .vscode/snippets.code-snippets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"createComment": {
"scope": "typescript,typescriptreact",
"prefix": "/**",
"prefix": "ccc",
"body": [
"/**",
" * ${1:description}",
Expand All @@ -10,8 +10,7 @@
" *",
" *```ts",
" * ${2:example}",
" *```",
" */"
" *```"
],
"description": "comment"
}
Expand Down
17 changes: 6 additions & 11 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
"version": "2.0.0",
"tasks": [
{
"label": "tsc",
"type": "shell",
"command": "./node_modules/.bin/tsc",
"args": ["--noEmit"],
"presentation": {
"reveal": "never",
"echo": false,
"focus": false,
"panel": "dedicated"
},
"problemMatcher": "$tsc-watch"
"label": "Check for type errors",
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": ["$tsc-watch"],
"group": "build"
}
]
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@
],
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.json",
"tsconfig": "tsconfig.json",
"babelConfig": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
],
[
"@babel/preset-react"
],
Expand All @@ -102,8 +110,7 @@
"<rootDir>/packages/dev/build/"
],
"moduleNameMapper": {
"perfect-freehand": "<rootDir>/packages/perfect-freehand/src",
"\\+(.*)": "<rootDir>/packages/perfect-freehand/src/$1"
"perfect-freehand": "<rootDir>/packages/perfect-freehand/src"
}
}
}
7 changes: 4 additions & 3 deletions packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"src"
],
"dependencies": {
"@radix-ui/react-checkbox": "^0.0.17",
"@modulz/radix-icons": "^4.0.0",
"@radix-ui/react-checkbox": "^0.1.0",
"@radix-ui/react-icons": "^1.0.3",
"@radix-ui/react-label": "^0.0.15",
"@radix-ui/react-slider": "^0.0.17",
"@radix-ui/react-label": "^0.1.0",
"@radix-ui/react-slider": "^0.1.0",
"@tldraw/core": "^0.0.94",
"@tldraw/intersect": "^0.0.93",
"@tldraw/vec": "^0.0.93",
Expand Down
6 changes: 5 additions & 1 deletion packages/dev/src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as React from 'react'
import * as Label from '@radix-ui/react-label'
import { Root, Indicator, CheckboxOwnProps } from '@radix-ui/react-checkbox'
import {
Root,
Indicator,
CheckboxProps as CheckboxOwnProps,
} from '@radix-ui/react-checkbox'
import styles from './checkbox.module.css'

interface CheckboxProps extends CheckboxOwnProps {
Expand Down
1 change: 0 additions & 1 deletion packages/dev/src/components/controls/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ export function Controls() {
/>
)}
<Slider
name="Stroke"
value={[style.strokeWidth]}
min={0}
max={100}
Expand Down
6 changes: 6 additions & 0 deletions packages/dev/src/components/editor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export function Editor(): JSX.Element {
} = app
const { page, pageState } = useAppState()

React.useEffect(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.freehand = app
}, [])

return (
<div className={styles.container}>
<Renderer
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function Panel() {
>
<button onClick={app.undo}>Undo</button>
<button onClick={app.redo}>Redo</button>
<button onClick={app.deleteAll}>Clear</button>
<button onClick={app.resetDoc}>Clear</button>
</div>
</>
)
Expand Down
8 changes: 5 additions & 3 deletions packages/dev/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Track,
Range,
Thumb,
SliderOwnProps,
SliderProps as SliderOwnProps,
} from '@radix-ui/react-slider'
import styles from './slider.module.css'

Expand All @@ -24,6 +24,7 @@ export function Slider({
min,
max,
step,
value = [0],
...props
}: SliderProps) {
const handleValueChange = React.useCallback(
Expand All @@ -45,14 +46,15 @@ export function Slider({
min={min}
max={max}
step={step}
value={value}
onPointerDown={onPointerDown}
onPointerUp={onPointerUp}
onValueChange={onValueChange}
>
<Track className={styles.track}>
<Range className={styles.range} />
</Track>
{props.value.map((_, i) => (
{value.map((_, i) => (
<Thumb className={styles.thumb} key={i}>
<div className={styles.thumbBall} />
</Thumb>
Expand All @@ -61,7 +63,7 @@ export function Slider({
<input
className={styles.numberInput}
type="number"
value={props.value[0]}
value={value[0]}
min={min}
max={max}
step={step}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/hooks/useKeyboardShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export function useKeyboardShortcuts() {
})

useHotkeys('e,backspace', () => {
app.deleteAll()
app.resetDoc()
})
}
Loading