I want to move the bulk of the scheme sketcher code into a new git repo, exposed as a Sveltekit library. The goal is to more easily use pieces of this from other projects, such as the inspectorate tools. It's not an easy refactor; the bulk of the core drawing logic is already in maplibre-draw-polygon and route-snapper, but the code here manages the toolbox, switches modes, manages the store with the GeoJSON features, etc.
Roughly the split of responsibility I picture is like this. The sketch library will handle lib/draw/ and parts of lib/sidebar -- giving people the mode switching logic, multi layer (scheme) management, sidebar controls, etc. What will remain in this repo (and have a new, much simpler variation in inspectorate tools) is per-schema forms, backfilling logic, etc. So the library shouldn't really care about feature properties beyond a few of the truly common ones.
This PR is a first step that makes lib/draw/ much more self-contained and starts teasing apart the types. I think even as a standalone refactor without doing the rest, it has some value. It's not complete -- the code still pulls in repo-wide map and userSetings stores, and I need to think through how to make the SchemeCollection type more generic. Assuming tests pass and there are no comments, I'll merge next time I work on this. A next step will probably be starting the new repo and discovering more tricky complications.
I want to move the bulk of the scheme sketcher code into a new git repo, exposed as a Sveltekit library. The goal is to more easily use pieces of this from other projects, such as the inspectorate tools. It's not an easy refactor; the bulk of the core drawing logic is already in
maplibre-draw-polygon
androute-snapper
, but the code here manages the toolbox, switches modes, manages the store with the GeoJSON features, etc.Roughly the split of responsibility I picture is like this. The sketch library will handle
lib/draw/
and parts oflib/sidebar
-- giving people the mode switching logic, multi layer (scheme) management, sidebar controls, etc. What will remain in this repo (and have a new, much simpler variation in inspectorate tools) is per-schema forms, backfilling logic, etc. So the library shouldn't really care about feature properties beyond a few of the truly common ones.This PR is a first step that makes
lib/draw/
much more self-contained and starts teasing apart the types. I think even as a standalone refactor without doing the rest, it has some value. It's not complete -- the code still pulls in repo-widemap
anduserSetings
stores, and I need to think through how to make theSchemeCollection
type more generic. Assuming tests pass and there are no comments, I'll merge next time I work on this. A next step will probably be starting the new repo and discovering more tricky complications.