diff --git a/packages/common/src/lib/form/form-group/form-group.component.ts b/packages/common/src/lib/form/form-group/form-group.component.ts index 380d378953..e63a3b369a 100644 --- a/packages/common/src/lib/form/form-group/form-group.component.ts +++ b/packages/common/src/lib/form/form-group/form-group.component.ts @@ -1,8 +1,6 @@ import { Component, Input, - Output, - EventEmitter, ChangeDetectionStrategy } from '@angular/core'; @@ -26,11 +24,6 @@ export class FormGroupComponent { */ @Input() group: FormFieldGroup; - /** - * Event emitted when the form control changes - */ - @Output() formControlChanges = new EventEmitter(); - constructor() {} /** diff --git a/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field-input.component.ts b/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field-input.component.ts index 5abbbf0765..3184734781 100644 --- a/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field-input.component.ts +++ b/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field-input.component.ts @@ -3,7 +3,6 @@ import { Input, OnInit, OnDestroy, - HostBinding, Optional, Self, ChangeDetectorRef, @@ -68,7 +67,6 @@ export class GeometryFormFieldInputComponent implements OnInit, OnDestroy, Contr if (this.ready === false) { return; } - this.deactivateControl(); this.createDrawControl(); this.toggleControl(); diff --git a/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field.component.html b/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field.component.html index 85c87af65c..5a23068e3b 100644 --- a/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field.component.html +++ b/packages/geo/src/lib/geometry/geometry-form-field/geometry-form-field.component.html @@ -7,35 +7,33 @@
+ [ngModel]="geometryTypeModel" + (ngModelChange)="onGeometryTypeChange($event)"> {{'igo.geo.geometry.point' | translate}} {{'igo.geo.geometry.line' | translate}} {{'igo.geo.geometry.polygon' | translate}}
- + = new BehaviorSubject(undefined); - public drawGuide$: BehaviorSubject = new BehaviorSubject(0); - public value$: BehaviorSubject = new BehaviorSubject(undefined); + geometryType$: BehaviorSubject = new BehaviorSubject(undefined); + drawGuide$: BehaviorSubject = new BehaviorSubject(0); + value$: BehaviorSubject = new BehaviorSubject(undefined); private value$$: Subscription; @@ -48,9 +49,7 @@ export class GeometryFormFieldComponent implements OnInit, OnDestroy { /** * The geometry type */ - @Input() - set geometryType(value: OlGeometryType) { this.geometryType$.next(value); } - get geometryType(): OlGeometryType { return this.geometryType$.value; } + @Input() geometryType: OlGeometryType; /** * Whether a geometry type toggle should be displayed @@ -70,20 +69,34 @@ export class GeometryFormFieldComponent implements OnInit, OnDestroy { /** * The drawGuide around the mouse pointer to help drawing */ - @Input() - set drawGuide(value: number) { this.drawGuide$.next(value); } - get drawGuide(): number { return this.drawGuide$.value; } + @Input() drawGuide: number = 0; /** * Draw guide placeholder */ @Input() drawGuidePlaceholder: string = ''; + /** + * The geometry type model + */ + set geometryTypeModel(value: OlGeometryType) {this.geometryType$.next(value); } + get geometryTypeModel(): OlGeometryType { return this.geometryType$.value; } + + /** + * The draw guide model + */ + set drawGuideModel(value: number) {this.drawGuide$.next(value); } + get drawGuideModel(): number { return this.drawGuide$.value; } + + constructor(private cdRef: ChangeDetectorRef) {} + /** * Set up a value stream * @internal */ ngOnInit() { + this.geometryType$.next(this.geometryType); + this.drawGuide$.next(this.drawGuide); this.value$.next(this.formControl.value ? this.formControl.value : undefined); this.value$$ = this.formControl.valueChanges.subscribe((value: GeoJSONGeometry) => { this.value$.next(value ? value : undefined); @@ -102,11 +115,11 @@ export class GeometryFormFieldComponent implements OnInit, OnDestroy { if (this.value$.value !== undefined) { return; } - this.geometryType = geometryType; + this.geometryType$.next(geometryType); } onDrawGuideChange(value: number) { - this.drawGuide = value; + this.drawGuide$.next(value); } }