Skip to content

Commit

Permalink
Switch to default export from the module
Browse files Browse the repository at this point in the history
  • Loading branch information
vasturiano committed Dec 13, 2024
1 parent 1dc0eaf commit 560a228
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Examples:
## Quick start

```js
import { ConicPolygonGeometry } from 'three-conic-polygon-geometry';
import ConicPolygonGeometry from 'three-conic-polygon-geometry';
```
or using a *script* tag
```html
Expand All @@ -27,7 +27,7 @@ or using a *script* tag
then
```js
const myMesh = new THREE.Mesh(
new THREE.ConicPolygonGeometry(polygonGeoJson),
new ConicPolygonGeometry(polygonGeoJson),
new THREE.MeshBasicMaterial({ color: 'blue' })
);

Expand Down
8 changes: 4 additions & 4 deletions example/countries-gdp-per-capita/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"three/addons/": "https://esm.sh/three/examples/jsm/"
}}</script>

<script type="module">import * as THREE from 'three'; window.THREE = { ...THREE };</script>
<script src="//unpkg.com/three-conic-polygon-geometry" defer></script>
<!-- <script src="../../dist/three-conic-polygon-geometry.js" defer></script>-->
<!-- <script type="module">import * as THREE from 'three'; window.THREE = THREE;</script>-->
<!-- <script src="../../dist/three-conic-polygon-geometry.js" defer></script>-->
</head>

<body>
<div id="viz"></div>

<script type="module">
import ConicPolygonGeometry from 'https://esm.sh/three-conic-polygon-geometry?external=three';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js?external=three';

fetch('../geojson/ne_110m_admin_0_countries.geojson').then(res => res.json()).then(countries =>
Expand All @@ -33,7 +33,7 @@
polygons.forEach(coords => {
polygonMeshes.push(
new THREE.Mesh(
new THREE.ConicPolygonGeometry(coords, 0, alt),
new ConicPolygonGeometry(coords, 0, alt),
materials
)
);
Expand Down
6 changes: 3 additions & 3 deletions example/countries/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"three/addons/": "https://esm.sh/three/examples/jsm/"
}}</script>

<script type="module">import * as THREE from 'three'; window.THREE = { ...THREE };</script>
<script src="//unpkg.com/three-conic-polygon-geometry" defer></script>
<!-- <script type="module">import * as THREE from 'three'; window.THREE = THREE;</script>-->
<!-- <script src="../../dist/three-conic-polygon-geometry.js" defer></script>-->
</head>

<body>
<div id="viz"></div>

<script type="module">
import ConicPolygonGeometry from 'https://esm.sh/three-conic-polygon-geometry?external=three';
import { TrackballControls } from 'three/addons/controls/TrackballControls.js?external=three';

fetch('../geojson/ne_110m_admin_0_countries.geojson').then(res => res.json()).then(countries =>
Expand All @@ -33,7 +33,7 @@
polygons.forEach(coords => {
polygonMeshes.push(
new THREE.Mesh(
new THREE.ConicPolygonGeometry(coords, alt / 10, alt, true, true, true, 1),
new ConicPolygonGeometry(coords, alt / 10, alt, true, true, true, 1),
materials
)
);
Expand Down
3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const { name, homepage, version, dependencies, peerDependencies } = pkg;

const umdConf = {
format: 'umd',
extend: true,
name: 'THREE',
name: 'ConicPolygonGeometry',
globals: { three: 'THREE' },
banner: `// Version ${version} ${name} - ${homepage}`
};
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import geoPolygonTriangulate from './geoPolygonTriangulate';
// support both modes for backwards threejs compatibility
const setAttributeFn = new THREE.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';

class ConicPolygonBufferGeometry extends THREE.BufferGeometry {
class ConicPolygonGeometry extends THREE.BufferGeometry {
constructor(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
super();

this.type = 'ConicPolygonBufferGeometry';
this.type = 'ConicPolygonGeometry';

this.parameters = {
polygonGeoJson,
Expand Down Expand Up @@ -139,4 +139,4 @@ function polar2Cartesian(lat, lng, r = 0) {
];
}

export { ConicPolygonBufferGeometry, ConicPolygonBufferGeometry as ConicPolygonGeometry };
export default ConicPolygonGeometry;

0 comments on commit 560a228

Please sign in to comment.