Skip to content

Commit

Permalink
* feat(toolbox): parent-children between catalog and catalogBrowser (#…
Browse files Browse the repository at this point in the history
…405)

* blad

* nhj

* feat/ui (search-assemblage): panel de détails, bouton add/remove layer, cleanFeature

* <feat/ui>(sidenav) : scrollable vs scroll button, zoom button (tablet), expansion panel (mobile)

* ui(sidenav): scroll button

* feat(toolbox): parent-children between catalog and catalogBrowser

* package
  • Loading branch information
PhilippeLafreniere18 authored and mbarbeau committed Sep 11, 2019
1 parent 6e8c62e commit e6e53a2
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/common/src/lib/tool/shared/tool.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export interface Tool {
tooltip?: string;
options?: { [key: string]: any };

parent?: string;
children?: string[];

// This is still used with the API but should be removed ultimately
id?: string;
}
Expand Down
34 changes: 34 additions & 0 deletions packages/common/src/lib/tool/shared/toolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,40 @@ export class Toolbox {
this.activateTool(previous);
}

/**
* Activate the tool below, if any
*/
/* activateBelowTool() {
const arrayTools = this.getToolbar();
const index = arrayTools.findIndex(t => t === this.activeTool$.getValue().name);
if (arrayTools[index + 1] !== undefined) {
this.deactivateTool();
const below = arrayTools[index + 1];
this.activateTool(below);
} else {
this.deactivateTool();
const below = arrayTools[0];
this.activateTool(below);
}
} */

/**
* Activate the tool above, if any
*/
/* activateAboveTool() {
const arrayTools = this.getToolbar();
const index = arrayTools.findIndex(t => t === this.activeTool$.getValue().name);
if (arrayTools[index - 1] !== undefined) {
this.deactivateTool();
const above = arrayTools[index - 1];
this.activateTool(above);
} else {
this.deactivateTool();
const above = arrayTools[arrayTools.length - 1];
this.activateTool(above);
}
} */

/**
* Deactivate the active tool
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/common/src/lib/tool/toolbox/toolbox.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ igo-actionbar ::ng-deep igo-actionbar-item.tool-actived ::ng-deep mat-list-item
background-color: #e0e0e0;
}

igo-actionbar ::ng-deep igo-actionbar-item.children-tool-actived ::ng-deep mat-list-item {
background-color: #e0e0e0;
}

igo-dynamic-outlet {
overflow: auto;
}
9 changes: 7 additions & 2 deletions packages/common/src/lib/tool/toolbox/toolbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
Input,
OnDestroy,
OnInit,
ChangeDetectionStrategy
ChangeDetectionStrategy,
Output
} from '@angular/core';

import { Subscription, BehaviorSubject } from 'rxjs';
Expand Down Expand Up @@ -137,8 +138,12 @@ export class ToolboxComponent implements OnInit, OnDestroy {
return (tool: Tool) => {
if (!this.toolbox.activeTool$.value) {
return;
} else {
if (this.toolbox.activeTool$.value.parent) {
return { 'children-tool-actived': tool.id === this.toolbox.activeTool$.value.parent };
}
return { 'tool-actived': tool.id === this.toolbox.activeTool$.value.name };
}
return { 'tool-actived': tool.id === this.toolbox.activeTool$.value.name };
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { CatalogState } from '../catalog.state';
@ToolComponent({
name: 'catalogBrowser',
title: 'igo.integration.tools.catalog',
icon: 'photo-browser'
icon: 'photo-browser',
parent: 'catalog'
})
@Component({
selector: 'igo-catalog-browser-tool',
Expand Down
8 changes: 8 additions & 0 deletions packages/integration/src/lib/context/context.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export class ContextState {
tools.push(tool);
});

tools.forEach(tool => {
if (tool.parent) {
const parentIndex = tools.findIndex(el => el.name === tool.parent);
tools[parentIndex].children = [];
tools[parentIndex].children.push(tool.name);
}
});

toolbox.setTools(tools);
toolbox.setToolbar(context.toolbar || []);

Expand Down

0 comments on commit e6e53a2

Please sign in to comment.