From 9a2abf94d033019549020093832e75dce91ce36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 1 Nov 2018 15:55:37 -0400 Subject: [PATCH] feat(route): provide new key to control which tool to open by default (#222) * feat(route) provide new key to control which tool to open by default * feat(tool.service) Open a tool based on url ex : &tool=about * refactor(tool-service) move url control to igo2 (out of the current lib) --- projects/context/src/lib/tool/shared/tool.service.ts | 2 ++ projects/core/src/lib/route/route.interface.ts | 1 + projects/core/src/lib/route/route.service.ts | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/context/src/lib/tool/shared/tool.service.ts b/projects/context/src/lib/tool/shared/tool.service.ts index be1eb6e9d9..da84905907 100644 --- a/projects/context/src/lib/tool/shared/tool.service.ts +++ b/projects/context/src/lib/tool/shared/tool.service.ts @@ -20,6 +20,7 @@ export class ToolService { public toolHistory$ = new BehaviorSubject([]); public selectedTool$ = new BehaviorSubject(undefined); private baseUrl: string; + public allowedToolName = []; static register(tool: Tool, cls?: Component) { ToolService.toolDefs[tool.name] = [Object.assign({}, tool), cls]; @@ -31,6 +32,7 @@ export class ToolService { this.tools$.subscribe(rep => this.handleToolsChange()); const tools = Object.keys(ToolService.toolDefs).map(name => { + this.allowedToolName.push(name); return { name: name }; }); this.setTools(tools); diff --git a/projects/core/src/lib/route/route.interface.ts b/projects/core/src/lib/route/route.interface.ts index a2a1db8f01..482a9c4c35 100644 --- a/projects/core/src/lib/route/route.interface.ts +++ b/projects/core/src/lib/route/route.interface.ts @@ -7,4 +7,5 @@ export interface RouteServiceOptions { visibleOnLayersKey?: boolean | string; visibleOffLayersKey?: boolean | string; routingCoordKey?: boolean | string; + toolKey?: boolean | string; } diff --git a/projects/core/src/lib/route/route.service.ts b/projects/core/src/lib/route/route.service.ts index a59d0e2d92..1a44b55cc3 100644 --- a/projects/core/src/lib/route/route.service.ts +++ b/projects/core/src/lib/route/route.service.ts @@ -35,7 +35,8 @@ export class RouteService { searchKey: 'search', visibleOnLayersKey: 'visiblelayers', visibleOffLayersKey: 'invisiblelayers', - routingCoordKey: 'routing' + routingCoordKey: 'routing', + toolKey: 'tool' }; this.options = Object.assign({}, defaultOptions, options); }