Skip to content

Commit 1d0262d

Browse files
committed
Website updates
1 parent 531d419 commit 1d0262d

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

dist/en/main/examples/filter-points-webgl.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ <h5 class="source-heading">main.js</h5>
254254
];
255255

256256
const style &#x3D; {
257-
variables: {
258-
minYear: 1850,
259-
maxYear: 2015,
260-
},
261257
filter: [&#x27;between&#x27;, [&#x27;get&#x27;, &#x27;year&#x27;], [&#x27;var&#x27;, &#x27;minYear&#x27;], [&#x27;var&#x27;, &#x27;maxYear&#x27;]],
262258
&#x27;circle-radius&#x27;: [
263259
&#x27;*&#x27;,
@@ -276,6 +272,16 @@ <h5 class="source-heading">main.js</h5>
276272
&#x27;circle-opacity&#x27;: [&#x27;-&#x27;, 1.0, [&#x27;*&#x27;, animRatio, 0.75]],
277273
};
278274

275+
const pointsLayer &#x3D; new WebGLPointsLayer({
276+
variables: {
277+
minYear: 1850,
278+
maxYear: 2015,
279+
},
280+
style: style,
281+
source: vectorSource,
282+
disableHitDetection: true,
283+
});
284+
279285
// handle input values &amp; events
280286
const minYearInput &#x3D; document.getElementById(&#x27;min-year&#x27;);
281287
const maxYearInput &#x3D; document.getElementById(&#x27;max-year&#x27;);
@@ -287,11 +293,11 @@ <h5 class="source-heading">main.js</h5>
287293
}
288294

289295
minYearInput.addEventListener(&#x27;input&#x27;, function () {
290-
style.variables.minYear &#x3D; parseInt(minYearInput.value);
296+
pointsLayer.updateStyleVariables({minYear: parseInt(minYearInput.value)});
291297
updateStatusText();
292298
});
293299
maxYearInput.addEventListener(&#x27;input&#x27;, function () {
294-
style.variables.maxYear &#x3D; parseInt(maxYearInput.value);
300+
pointsLayer.updateStyleVariables({maxYear: parseInt(minYearInput.value)});
295301
updateStatusText();
296302
});
297303
updateStatusText();
@@ -336,11 +342,7 @@ <h5 class="source-heading">main.js</h5>
336342
layer: &#x27;stamen_toner&#x27;,
337343
}),
338344
}),
339-
new WebGLPointsLayer({
340-
style: style,
341-
source: vectorSource,
342-
disableHitDetection: true,
343-
}),
345+
pointsLayer,
344346
],
345347
target: document.getElementById(&#x27;map&#x27;),
346348
view: new View({

dist/en/main/examples/filter-points-webgl.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/filter-points-webgl.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/icon-sprite-webgl.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ <h5 class="source-heading">main.js</h5>
239239
const newColor &#x3D; [180, 255, 200];
240240

241241
const style &#x3D; {
242-
variables: {
243-
filterShape: &#x27;all&#x27;,
244-
},
245242
filter: [
246243
&#x27;any&#x27;,
247244
[&#x27;&#x3D;&#x3D;&#x27;, [&#x27;var&#x27;, &#x27;filterShape&#x27;], &#x27;all&#x27;],
@@ -282,9 +279,20 @@ <h5 class="source-heading">main.js</h5>
282279
&#x27;icon-scale&#x27;: 0.5,
283280
};
284281

282+
const pointsLayer &#x3D; new WebGLPointsLayer({
283+
variables: {
284+
filterShape: &#x27;all&#x27;,
285+
},
286+
source: new VectorSource({
287+
features: [],
288+
attributions: &#x27;National UFO Reporting Center&#x27;,
289+
}),
290+
style: style,
291+
});
292+
285293
const shapeSelect &#x3D; document.getElementById(&#x27;shape-filter&#x27;);
286294
shapeSelect.addEventListener(&#x27;input&#x27;, function () {
287-
style.variables.filterShape &#x3D; shapeSelect.value;
295+
pointsLayer.updateStyleVariables({filterShape: shapeSelect.value});
288296
map.render();
289297
});
290298
function fillShapeSelect(shapeTypes) {
@@ -332,15 +340,8 @@ <h5 class="source-heading">main.js</h5>
332340
);
333341
}
334342
shapeTypes[&#x27;all&#x27;] &#x3D; features.length;
335-
map.addLayer(
336-
new WebGLPointsLayer({
337-
source: new VectorSource({
338-
features: features,
339-
attributions: &#x27;National UFO Reporting Center&#x27;,
340-
}),
341-
style: style,
342-
}),
343-
);
343+
pointsLayer.getSource().addFeatures(features);
344+
map.addLayer(pointsLayer);
344345
fillShapeSelect(shapeTypes);
345346
});
346347
client.send();

0 commit comments

Comments
 (0)