Skip to content

Commit

Permalink
## 2.1.2
Browse files Browse the repository at this point in the history
Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements and bugs.

#### ✨ Enhancements

- #125 three.js draw geojson.
- #126 add options.rotate and options.scale for Objects3D.
- #127 Create a new example with Three.js extrusions based on standard geoJson. Added a new example [17-extrusions.html](https://github.com/jscastro76/threebox/blob/master/examples/17-extrusions.html)
- #130 Convert internal variables (`selectedObject`, `draggedObject`, ...) into instance variables .
- #134 Deprecate `tb.setLayerZoomVisibility`, overlaps with `tb.toggleLayer`.
- #138 expose `SunCalc.toJulian`

#### 🪲 Bug fixes

- #124 when an object is wireframed, all its clones are too.
- #131 Error when wireframing all the objects.
- #132 While dragging an object if mouse overs a label it stops dragging.
- #133 A layer shouldn't be shown explicitely if it's not in the right zoom range.
  • Loading branch information
jscastro76 committed Dec 9, 2020
1 parent af6b29d commit 42ac721
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 27 deletions.
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements

#### :sparkles: Enhancements

- three.js draw geojson #125
- add options.rotate and options.scale for Objects3D #126
- Create a new example with Three.js extrusions based on standard geoJson #127 Added a new example [17-extrusions.html](https://github.com/jscastro76/threebox/blob/master/examples/17-extrusions.html)
- Convert internal variables (`selectedObject`, `draggedObject`, ...) into instance variables #130
- Deprecate `tb.setLayerZoomVisibility`, overlaps with `tb.toggleLayer` #134
- #125 three.js draw geojson.
- #126 add options.rotate and options.scale for Objects3D.
- #127 Create a new example with Three.js extrusions based on standard geoJson. Added a new example [17-extrusions.html](https://github.com/jscastro76/threebox/blob/master/examples/17-extrusions.html)
- #130 Convert internal variables (`selectedObject`, `draggedObject`, ...) into instance variables .
- #134 Deprecate `tb.setLayerZoomVisibility`, overlaps with `tb.toggleLayer`.
- #138 expose `SunCalc.toJulian`

#### :beetle: Bug fixes

- when an object is wireframed, all its clones are too #124
- Error when wireframing all the objects #131
- While dragging an object if mouse overs a label it stops dragging #132
- A layer shouldn't be shown explicitely if it's not in the right zoom range #133

- #124 when an object is wireframed, all its clones are too.
- #131 Error when wireframing all the objects.
- #132 While dragging an object if mouse overs a label it stops dragging.
- #133 A layer shouldn't be shown explicitely if it's not in the right zoom range.
<br>

- - -
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![NPM license](http://img.shields.io/npm/l/threebox-plugin.svg?style=flat-square)](https://www.npmjs.org/package/threebox-plugin)
![npm](https://img.shields.io/npm/dt/threebox-plugin?style=social)

A **[*Three.js*](https://threejs.org/)** plugin for **[*Mapbox GL JS*](https://docs.mapbox.com/mapbox-gl-js/examples/)**, using the [`CustomLayerInterface`](https://docs.mapbox.com/mapbox-gl-js/api/properties/#customlayerinterface) feature. Provides convenient methods to manage objects in lnglat coordinates, and to synchronize the map and scene cameras.
A **[*Three.js*](https://threejs.org/)** plugin for **[*Mapbox GL JS*](https://docs.mapbox.com/mapbox-gl-js/examples/)** and **[Azure Maps](https://azure.microsoft.com/en-us/services/azure-maps/)** using the [`CustomLayerInterface`](https://docs.mapbox.com/mapbox-gl-js/api/properties/#customlayerinterface) feature. Provides convenient methods to manage objects in lnglat coordinates, and to synchronize the map and scene cameras.
<img alt="threebox" src="docs/gallery.jpg">

<br>
Expand Down Expand Up @@ -46,20 +46,21 @@ npm i threebox-plugin
<br>

Only in this fork, there is a list of new features implemented on top of the amazing work from [@peterqliu](https://github.com/peterqliu/threebox/):
- Update to Three.js v117.
- Update to Mapbox-gl-js v1.11.1.
- [18 examples](https://github.com/jscastro76/threebox/tree/master/examples) with new features.
- Updated to Three.js v117.
- Updated to Mapbox-gl-js v1.11.1.
- Updated to Azure Maps v2.0.31.
- [18 examples](https://github.com/jscastro76/threebox/tree/master/examples) with all the new features.
- Support for multiple 3D format objects (FBX, GLTF/GLB, Collada, OBJ/MTL).
- Support for CSS2D labels supporting rich HTML controls through a new LabelManager.
- Support for CSS2D tooltips/title browser-like and mapbox-like.
- Support for built-in shadows and real Sun light positioning for a given datetime and lnglat coords.
- Support for built-in Raycaster in loaded Object3D and fill-extrusions together.
- Support for built-in Raycaster in Object3D and fill-extrusions together.
- Support for built-in MouseOver/Mouseout, Selected, Drag&Drop, Drag&Rotate, Wireframe in loadedObjects including events.
- Support for [GeoJson](https://geojson.org/) standard features format import and export in different layers.
- Support for Object3D embedded animations, and combined animations on AnimationManager (i.e. translate + embedded).
- Support for multi-floor design of spaces.
- Support for Object3D embedded animations, and custom animations on AnimationManager (i.e. embedded animation + translate + rotate).
- Support for multi-floor/layer design of spaces.
- Support for Non-AABB Non Axes Aligned Bounding Box and real model size.
- Support for wireframing on Object3D, removing them from the raycast.
- Support for wireframing on any Object3D, removing them from the raycast.
- Support for `setLayerZoomRange` and `setLayoutProperty` on Custom Layers (not available in Mapbox).
- Support for `removeLayer` considering Object3D.
- Support for style change through `setStyle` and keeping Object3D.
Expand Down
7 changes: 5 additions & 2 deletions dist/threebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ Threebox.prototype = {
return;
}
let z = this.map.getZoom();
if (l.minzoom && z < l.minzoom) { console.log("< minzoom"); this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { console.log(">= maxzoom"); this.toggle(l.id, false); return; };
if (l.minzoom && z < l.minzoom) { this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { this.toggle(l.id, false); return; };
this.toggle(l.id, true);
};
},
Expand Down Expand Up @@ -18621,6 +18621,9 @@ module.exports = exports = material;
function fromJulian(j) { return new Date((j + 0.5 - J1970) * dayMs); }
function toDays(date) { return toJulian(date) - J2000; }

SunCalc.toJulian = function (date) {
return toJulian(date);
};

// general calculations for position

Expand Down
4 changes: 2 additions & 2 deletions dist/threebox.min.js

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions docs/Threebox.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,24 @@ This method gets Sun light position (azimuth, altitude) based on `suncalc.js.` m
tb.getSunTimes(date, coords)
```
This method gets Sun times based on `suncalc.js.` module which calculates the times for the different light phases (sunrise, sunset, etc..) from a given datetime, lng, lat and alt. This is used to change the map style based on day/night hour.
Returns an object with the following properties (each is a `Date` object):
| Property | Description |
| --------------- | ------------------------------------------------------------------------ |
| `sunrise` | sunrise (top edge of the sun appears on the horizon) |
| `sunriseEnd` | sunrise ends (bottom edge of the sun touches the horizon) |
| `goldenHourEnd` | morning golden hour (soft light, best time for photography) ends |
| `solarNoon` | solar noon (sun is in the highest position) |
| `goldenHour` | evening golden hour starts |
| `sunsetStart` | sunset starts (bottom edge of the sun touches the horizon) |
| `sunset` | sunset (sun disappears below the horizon, evening civil twilight starts) |
| `dusk` | dusk (evening nautical twilight starts) |
| `nauticalDusk` | nautical dusk (evening astronomical twilight starts) |
| `night` | night starts (dark enough for astronomical observations) |
| `nadir` | nadir (darkest moment of the night, sun is in the lowest position) |
| `nightEnd` | night ends (morning astronomical twilight starts) |
| `nauticalDawn` | nautical dawn (morning nautical twilight starts) |
| `dawn` | dawn (morning nautical twilight ends, morning civil twilight starts) |
<br>
Expand Down
2 changes: 1 addition & 1 deletion examples/18-extrusions.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
});
star.addTooltip("A animated extruded star over Columbus Park", true);
star.setCoords(origin2);
star.set({ rotation: {x: 0, y: 0, z: 720}, duration: 10000 })
star.set({ rotation: {x: 0, y: 0, z: 720}, duration: 20000 })
tb.add(star);

//[jscastro] we read a geoJson that is filled with 3 real features from the composite source
Expand Down
4 changes: 2 additions & 2 deletions src/Threebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ Threebox.prototype = {
return;
}
let z = this.map.getZoom();
if (l.minzoom && z < l.minzoom) { console.log("< minzoom"); this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { console.log(">= maxzoom"); this.toggle(l.id, false); return; };
if (l.minzoom && z < l.minzoom) { this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { this.toggle(l.id, false); return; };
this.toggle(l.id, true);
};
},
Expand Down
3 changes: 3 additions & 0 deletions src/utils/suncalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
function fromJulian(j) { return new Date((j + 0.5 - J1970) * dayMs); }
function toDays(date) { return toJulian(date) - J2000; }

SunCalc.toJulian = function (date) {
return toJulian(date);
};

// general calculations for position

Expand Down
7 changes: 5 additions & 2 deletions tests/threebox-tests-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9630,8 +9630,8 @@ Threebox.prototype = {
return;
}
let z = this.map.getZoom();
if (l.minzoom && z < l.minzoom) { console.log("< minzoom"); this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { console.log(">= maxzoom"); this.toggle(l.id, false); return; };
if (l.minzoom && z < l.minzoom) { this.toggle(l.id, false); return; };
if (l.maxzoom && z >= l.maxzoom) { this.toggle(l.id, false); return; };
this.toggle(l.id, true);
};
},
Expand Down Expand Up @@ -27559,6 +27559,9 @@ module.exports = exports = material;
function fromJulian(j) { return new Date((j + 0.5 - J1970) * dayMs); }
function toDays(date) { return toJulian(date) - J2000; }

SunCalc.toJulian = function (date) {
return toJulian(date);
};

// general calculations for position

Expand Down

0 comments on commit 42ac721

Please sign in to comment.