blob: 5dd47361c825b7110b8346c839e625e14f964fd7 [file] [log] [blame]
Sean Condon0c577f62018-11-18 22:40:05 +00001/*
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 */
16import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
17import {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})
32export 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}