mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(draw): hand one drawn area or line back to the application
createApplicationTools returns drawShape({ shape, signal }): it opens Draw
for one area or line and resolves with its Polygon or LineString without
placing a mark, or null when draw mode is left, the signal aborts, a newer
request replaces it, the pointer is held elsewhere or the tool goes. The
shape controls cannot change the asked-for shape, and a shape across the
antimeridian is refused as a row's actions refuse it and drawn again. It
also returns pointerFree, so an application's own click handlers yield to a
tool holding the pointer, as the layers' do.
This commit is contained in:
1 parent
027c9616a5
commit
4da477a654
5 files changed
+237
-2
No files matched your search
+14
-1
@@ -1,6 +1,7 @@
|
||||
import { SceneDirector } from '../scenes/director.js';
|
||||
import { initAnnotations } from '../annotations/index.js';
|
||||
import { initDrawTool } from '../annotations/drawTool.js';
|
||||
import { isPointerFree } from '../data/inputOwnership.js';
|
||||
import { initGeoFileImport } from '../ui/geoFileImport.js';
|
||||
import { useDisplayStore } from '../ui/stores/display.js';
|
||||
import { applicationPinia } from '../ui/vueRuntime.js';
|
||||
@@ -245,5 +246,17 @@ export function createApplicationTools({
|
||||
signal,
|
||||
}),
|
||||
);
|
||||
return { sceneDirector, annotations, voiceCommands };
|
||||
// Draw one area or line and get its geometry back, without placing a mark
|
||||
// (annotations/drawTool.js `drawShape`); null without the Draw controls.
|
||||
const drawShape = (options) =>
|
||||
drawTool ? drawTool.drawShape(options) : Promise.resolve(null);
|
||||
// An application's own click handlers yield while a tool holds the pointer,
|
||||
// as the layers' do (data/inputOwnership.js).
|
||||
return {
|
||||
sceneDirector,
|
||||
annotations,
|
||||
voiceCommands,
|
||||
drawShape,
|
||||
pointerFree: isPointerFree,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user