Skip to content

Commit 40f83b3

Browse files
committedDec 13, 2023
refactor(Style): supp collection.style and delete notion of style.parent
1 parent 5f22009 commit 40f83b3

File tree

4 files changed

+3
-35
lines changed

4 files changed

+3
-35
lines changed
 

‎src/Core/Feature.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export class FeatureCollection extends THREE.Object3D {
424424
/**
425425
* Updates the global transform of the object and its descendants.
426426
*
427-
* @param {booolean} force The force
427+
* @param {boolean} force The force
428428
*/
429429
updateMatrixWorld(force) {
430430
super.updateMatrixWorld(force);
@@ -498,12 +498,4 @@ export class FeatureCollection extends THREE.Object3D {
498498
this.features.push(ref);
499499
return ref;
500500
}
501-
502-
setParentStyle(style) {
503-
if (style) {
504-
this.features.forEach((f) => {
505-
f.style.parent = style;
506-
});
507-
}
508-
}
509501
}

‎src/Core/Style.js

+2-19
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,7 @@ function defineStyleProperty(style, category, name, value, defaultValue) {
146146
name,
147147
{
148148
enumerable: true,
149-
get: () => {
150-
if (property === undefined) {
151-
return style.parent[category][name] || defaultValue;
152-
} else {
153-
return property;
154-
}
155-
},
149+
get: () => property ?? defaultValue,
156150
set: (v) => {
157151
property = v;
158152
},
@@ -548,24 +542,13 @@ class Style {
548542
* @param {StyleOptions} [params={}] An object that contain any properties
549543
* (order, zoom, fill, stroke, point, text or/and icon)
550544
* and sub properties of a Style (@see {@link StyleOptions}).
551-
* @param {Style} [parent] The parent style, that is looked onto if a value
552-
* is missing.
553545
* @constructor
554546
*/
555-
constructor(params = {}, parent) {
547+
constructor(params = {}) {
556548
this.isStyle = true;
557549

558550
this.order = params.order || 0;
559551

560-
this.parent = parent || {
561-
zoom: {},
562-
fill: {},
563-
stroke: {},
564-
point: {},
565-
text: {},
566-
icon: {},
567-
};
568-
569552
params.zoom = params.zoom || {};
570553
params.fill = params.fill || {};
571554
params.stroke = params.stroke || {};

‎src/Source/FileSource.js

-4
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ class FileSource extends Source {
175175
this.extent.applyMatrix4(data.matrixWorld);
176176
}
177177
}
178-
179-
if (data.isFeatureCollection) {
180-
data.setParentStyle(options.out.style);
181-
}
182178
});
183179
}
184180

‎src/Source/VectorTilesSource.js

-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ class VectorTilesSource extends TMSSource {
138138
console.warn('With VectorTilesSource and FeatureGeometryLayer, the accurate option is always false');
139139
options.out.accurate = false;
140140
}
141-
const keys = Object.keys(this.styles);
142-
143-
keys.forEach((k) => { this.styles[k].parent = options.out.style; });
144141
}
145142
}
146143
}

0 commit comments

Comments
 (0)
Please sign in to comment.