@regionerne/gis-komponent 0.0.108 → 0.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1335,7 +1335,7 @@ class KomponentSettingsHelperService {
|
|
|
1335
1335
|
feature.getGeometry().setCoordinates(evt.coordinate);
|
|
1336
1336
|
});
|
|
1337
1337
|
}
|
|
1338
|
-
getFillColorFromStyle(style) {
|
|
1338
|
+
getFillColorFromStyle(style, geomType) {
|
|
1339
1339
|
let styles;
|
|
1340
1340
|
// resolve StyleFunction
|
|
1341
1341
|
if (typeof style === 'function') {
|
|
@@ -1350,9 +1350,11 @@ class KomponentSettingsHelperService {
|
|
|
1350
1350
|
if (!Array.isArray(styles)) {
|
|
1351
1351
|
styles = [styles];
|
|
1352
1352
|
}
|
|
1353
|
-
// find first style with fill
|
|
1353
|
+
// find first style with fill for Polygon
|
|
1354
1354
|
const fillStyle = styles.find((s) => s?.getFill?.());
|
|
1355
|
-
|
|
1355
|
+
// find first style with stroke for LineString
|
|
1356
|
+
const strokeStyle = styles.find((s) => s?.getStroke?.());
|
|
1357
|
+
return (geomType === 'Polygon' ? fillStyle?.getFill()?.getColor() : strokeStyle?.getStroke()?.getColor()) || null;
|
|
1356
1358
|
}
|
|
1357
1359
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: KomponentSettingsHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1358
1360
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: KomponentSettingsHelperService, providedIn: 'root' });
|
|
@@ -4145,7 +4147,7 @@ class ToolboxComponent {
|
|
|
4145
4147
|
this._cursorLayerForDraw = undefined;
|
|
4146
4148
|
}
|
|
4147
4149
|
// Extract fill color from style
|
|
4148
|
-
const fillColor = this._settingsHelper.getFillColorFromStyle(style) || 'rgba(0,0,255,0.3)';
|
|
4150
|
+
const fillColor = this._settingsHelper.getFillColorFromStyle(style, geomType) || 'rgba(0,0,255,0.3)';
|
|
4149
4151
|
// Create cursor layer (circle showing the Polygon's fill color)
|
|
4150
4152
|
this._cursorLayerForDraw = this._settingsHelper.createCursorLayer(fillColor);
|
|
4151
4153
|
this.map.addLayer(this._cursorLayerForDraw);
|