···194194Goal: determine what the cursor is over.
195195196196Geometry (/packages/core/src/geom):
197197-[ ] shapeBounds(shape) -> Box2
198198-[ ] pointInRect(p, rectShape) -> bool
199199-[ ] pointInEllipse(p, ellipseShape) -> bool
200200-[ ] pointNearSegment(p, a, b, tolerance) -> bool
201201-[ ] hitTestPoint(state, worldPoint) -> shapeId? (topmost wins)
197197+[x] shapeBounds(shape) -> Box2
198198+[x] pointInRect(p, rectShape) -> bool
199199+[x] pointInEllipse(p, ellipseShape) -> bool
200200+[x] pointNearSegment(p, a, b, tolerance) -> bool
201201+[x] hitTestPoint(state, worldPoint) -> shapeId? (topmost wins)
202202203203Layering:
204204-[ ] Define draw order = page.shapeIds order
205205-[ ] hitTest uses reverse order for topmost selection
204204+[x] Define draw order = page.shapeIds order
205205+[x] hitTest uses reverse order for topmost selection
206206207207Tests:
208208-[ ] hitTestPoint returns expected shapeId for overlapping shapes
209209-[ ] tolerance works for line/arrow selection
208208+[x] hitTestPoint returns expected shapeId for overlapping shapes
209209+[x] tolerance works for line/arrow selection
210210211211(DoD):
212212- You can hover shapes and log the hit shape id (no selection yet).
213213-214213215214==============================================================================
2162157. Milestone G: Input system (pointer + keyboard) *wb-G*
apps/.gitkeep
This is a binary file and will not be displayed.
+4
apps/web/.prettierignore
···7788# Miscellaneous
99/static/
1010+1111+# TS covered by dprint
1212+**/*.ts
1313+**/*.js
-38
apps/web/README.md
···11-# sv
22-33-Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
44-55-## Creating a project
66-77-If you're seeing this, you've probably already done this step. Congrats!
88-99-```sh
1010-# create a new project in the current directory
1111-npx sv create
1212-1313-# create a new project in my-app
1414-npx sv create my-app
1515-```
1616-1717-## Developing
1818-1919-Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
2020-2121-```sh
2222-npm run dev
2323-2424-# or start the server and open the app in a new browser tab
2525-npm run dev -- --open
2626-```
2727-2828-## Building
2929-3030-To create a production version of your app:
3131-3232-```sh
3333-npm run build
3434-```
3535-3636-You can preview the production build with `npm run preview`.
3737-3838-> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
+30-36
apps/web/eslint.config.js
···11-import prettier from 'eslint-config-prettier';
22-import { fileURLToPath } from 'node:url';
33-import { includeIgnoreFile } from '@eslint/compat';
44-import js from '@eslint/js';
55-import svelte from 'eslint-plugin-svelte';
66-import { defineConfig } from 'eslint/config';
77-import globals from 'globals';
88-import ts from 'typescript-eslint';
99-import svelteConfig from './svelte.config.js';
11+import { includeIgnoreFile } from "@eslint/compat";
22+import js from "@eslint/js";
33+import prettier from "eslint-config-prettier";
44+import svelte from "eslint-plugin-svelte";
55+import { defineConfig } from "eslint/config";
66+import globals from "globals";
77+import { fileURLToPath } from "node:url";
88+import ts from "typescript-eslint";
99+import svelteConfig from "./svelte.config.js";
10101111-const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
1111+const gitignorePath = fileURLToPath(new URL("./.gitignore", import.meta.url));
12121313export default defineConfig(
1414- includeIgnoreFile(gitignorePath),
1515- js.configs.recommended,
1616- ...ts.configs.recommended,
1717- ...svelte.configs.recommended,
1818- prettier,
1919- ...svelte.configs.prettier,
2020- {
2121- languageOptions: { globals: { ...globals.browser, ...globals.node } },
2222-2323- rules: {
2424- // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
2525- // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
2626- "no-undef": 'off'
2727- }
2828- },
2929- {
3030- files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
1414+ includeIgnoreFile(gitignorePath),
1515+ js.configs.recommended,
1616+ ...ts.configs.recommended,
1717+ ...svelte.configs.recommended,
1818+ prettier,
1919+ ...svelte.configs.prettier,
2020+ {
2121+ languageOptions: { globals: { ...globals.browser, ...globals.node } },
31223232- languageOptions: {
3333- parserOptions: {
3434- projectService: true,
3535- extraFileExtensions: ['.svelte'],
3636- parser: ts.parser,
3737- svelteConfig
3838- }
3939- }
4040- }
2323+ rules: {
2424+ // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
2525+ // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
2626+ "no-undef": "off",
2727+ },
2828+ },
2929+ {
3030+ files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
3131+ languageOptions: {
3232+ parserOptions: { projectService: true, extraFileExtensions: [".svelte"], parser: ts.parser, svelteConfig },
3333+ },
3434+ },
4135);