diff --git a/CHANGELOG.md b/CHANGELOG.md index 294f2db3..3bcb4803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements - THREE.MeshPhongMaterial({ color: 0x660000, side: THREE.DoubleSide }) added as default material to extrusions #### :beetle: Bug fixes +- #255 tb.updateSunGround raises an error if value is higher than 1. + - Multiplied also the raster-opacity by 4 to make it more realistic with the light hours - #319 dat.gui.module has changed in threejs - #320 Cannot read properties of undefined (reading 'appendChild') diff --git a/dist/threebox.js b/dist/threebox.js index cd5507a5..f3de26a0 100755 --- a/dist/threebox.js +++ b/dist/threebox.js @@ -1344,7 +1344,7 @@ Threebox.prototype = { updateSunGround: function (sunPos) { if (this.terrainLayerName != '') { // update the raster layer paint property with the position of the sun based on the selected time - this.map.setPaintProperty(this.terrainLayerName, 'raster-opacity', Math.max(sunPos.altitude, 0.25)); + this.map.setPaintProperty(this.terrainLayerName, 'raster-opacity', Math.max(Math.min(1, sunPos.altitude * 4), 0.25)); } }, diff --git a/src/Threebox.js b/src/Threebox.js index 7cdf80c2..c20dd4fa 100644 --- a/src/Threebox.js +++ b/src/Threebox.js @@ -1074,7 +1074,7 @@ Threebox.prototype = { updateSunGround: function (sunPos) { if (this.terrainLayerName != '') { // update the raster layer paint property with the position of the sun based on the selected time - this.map.setPaintProperty(this.terrainLayerName, 'raster-opacity', Math.max(sunPos.altitude, 0.25)); + this.map.setPaintProperty(this.terrainLayerName, 'raster-opacity', Math.max(Math.min(1, sunPos.altitude * 4), 0.25)); } },