Sean Condon | 0c577f6 | 2018-11-18 22:40:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the 'License'); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an 'AS IS' BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | import {Component, Input, OnChanges, SimpleChanges} from '@angular/core'; |
| 17 | import {SubRegion} from '../../models'; |
| 18 | |
| 19 | /** |
| 20 | * The SubRegion node in the force graph |
| 21 | * |
| 22 | * Note 1: here the selector is given square brackets [] so that it can be |
| 23 | * inserted in SVG element like a directive |
| 24 | * Note 2: the selector is exactly the same as the @Input alias to make this |
| 25 | * directive trick work |
| 26 | */ |
| 27 | @Component({ |
| 28 | selector: '[onos-subregionnodesvg]', |
| 29 | templateUrl: './subregionnodesvg.component.html', |
| 30 | styleUrls: ['./subregionnodesvg.component.css'] |
| 31 | }) |
| 32 | export class SubRegionNodeSvgComponent implements OnChanges { |
| 33 | @Input() subRegion: SubRegion; |
| 34 | |
| 35 | ngOnChanges(changes: SimpleChanges) { |
| 36 | if (!this.subRegion.x) { |
| 37 | this.subRegion.x = 0; |
| 38 | this.subRegion.y = 0; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | } |