Skip to content

Commit

Permalink
feat(route): provide new key to control which tool to open by default (
Browse files Browse the repository at this point in the history
…#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)
  • Loading branch information
pelord authored and mbarbeau committed Nov 1, 2018
1 parent ce6fa35 commit 9a2abf9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions projects/context/src/lib/tool/shared/tool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class ToolService {
public toolHistory$ = new BehaviorSubject<Tool[]>([]);
public selectedTool$ = new BehaviorSubject<Tool>(undefined);
private baseUrl: string;
public allowedToolName = [];

static register(tool: Tool, cls?: Component) {
ToolService.toolDefs[tool.name] = [Object.assign({}, tool), cls];
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions projects/core/src/lib/route/route.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export interface RouteServiceOptions {
visibleOnLayersKey?: boolean | string;
visibleOffLayersKey?: boolean | string;
routingCoordKey?: boolean | string;
toolKey?: boolean | string;
}
3 changes: 2 additions & 1 deletion projects/core/src/lib/route/route.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9a2abf9

Please sign in to comment.