Skip to content

Commit

Permalink
better 'import' usage
Browse files Browse the repository at this point in the history
fix #18
  • Loading branch information
Kcnarf committed Aug 12, 2022
1 parent 55e05b0 commit d3c848f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ d3-weighted-voronoi follows Mike Bostocks's [Let's make a D3 plugin](https://bos

d3-voronoi-treemap attempts to follow [semantic versioning](https://semver.org) and bump major version only when backwards incompatible changes are released.

1. change version number in package.json
2. change version number in README.md, section _installing_
1. change version number in package.json (1 occurence)
2. change version number in README.md, section _installing_ (2 occurences)
3. `git commit`
4. `git push`
5. `git tag -a vX.X.X`
Expand Down
33 changes: 15 additions & 18 deletions build/d3-voronoi-treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-voronoi-map')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-voronoi-map'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3));
}(this, function (exports,voronoiMap) { 'use strict';

voronoiMap = 'default' in voronoiMap ? voronoiMap['default'] : voronoiMap;
}(this, function (exports,d3VoronoiMap) { 'use strict';

function voronoiTreemap() {
//begin: constants
Expand Down Expand Up @@ -40,7 +38,7 @@
weight: 1,
},
];
var _convenientReusableVoronoiMap = voronoiMap.voronoiMapSimulation(unrelevantButNeedeData).stop();
var _convenientReusableVoronoiMapSimulation = d3VoronoiMap.voronoiMapSimulation(unrelevantButNeedeData).stop();
//end: internals

///////////////////////
Expand Down Expand Up @@ -84,11 +82,11 @@
}

//begin: use voronoiMap.clip() to handle clip/extent/size computation and borderline input (non-counterclockwise, non-convex, ...)
_convenientReusableVoronoiMap.clip(_);
_convenientReusableVoronoiMapSimulation.clip(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -98,11 +96,11 @@
}

//begin: use voronoiMap.extent() to handle clip/extent/size computation
_convenientReusableVoronoiMap.extent(_);
_convenientReusableVoronoiMapSimulation.extent(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -112,11 +110,11 @@
}

//begin: use voronoiMap.size() to handle clip/extent/size computation
_convenientReusableVoronoiMap.size(_);
_convenientReusableVoronoiMapSimulation.size(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -141,8 +139,7 @@

if (node.height != 0) {
//compute one-level Voronoi map of children
simulation = voronoiMap
.voronoiMapSimulation(node.children)
simulation = d3VoronoiMap.voronoiMapSimulation(node.children)
.clip(clippingPolygon)
.weight(function (d) {
return d.value;
Expand Down
2 changes: 1 addition & 1 deletion build/d3-voronoi-treemap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions src/d3-voronoi-treemap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import voronoiMap from 'd3-voronoi-map';
import { voronoiMapSimulation as d3VoronoiMapSimulation } from 'd3-voronoi-map';

export function voronoiTreemap() {
//begin: constants
Expand Down Expand Up @@ -34,7 +34,7 @@ export function voronoiTreemap() {
weight: 1,
},
];
var _convenientReusableVoronoiMap = voronoiMap.voronoiMapSimulation(unrelevantButNeedeData).stop();
var _convenientReusableVoronoiMapSimulation = d3VoronoiMapSimulation(unrelevantButNeedeData).stop();
//end: internals

///////////////////////
Expand Down Expand Up @@ -78,11 +78,11 @@ export function voronoiTreemap() {
}

//begin: use voronoiMap.clip() to handle clip/extent/size computation and borderline input (non-counterclockwise, non-convex, ...)
_convenientReusableVoronoiMap.clip(_);
_convenientReusableVoronoiMapSimulation.clip(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -92,11 +92,11 @@ export function voronoiTreemap() {
}

//begin: use voronoiMap.extent() to handle clip/extent/size computation
_convenientReusableVoronoiMap.extent(_);
_convenientReusableVoronoiMapSimulation.extent(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -106,11 +106,11 @@ export function voronoiTreemap() {
}

//begin: use voronoiMap.size() to handle clip/extent/size computation
_convenientReusableVoronoiMap.size(_);
_convenientReusableVoronoiMapSimulation.size(_);
//end: use voronoiMap.clip() to handle clip/extent/size computation
clip = _convenientReusableVoronoiMap.clip();
extent = _convenientReusableVoronoiMap.extent();
size = _convenientReusableVoronoiMap.size();
clip = _convenientReusableVoronoiMapSimulation.clip();
extent = _convenientReusableVoronoiMapSimulation.extent();
size = _convenientReusableVoronoiMapSimulation.size();
return _voronoiTreemap;
};

Expand All @@ -135,8 +135,7 @@ export function voronoiTreemap() {

if (node.height != 0) {
//compute one-level Voronoi map of children
simulation = voronoiMap
.voronoiMapSimulation(node.children)
simulation = d3VoronoiMapSimulation(node.children)
.clip(clippingPolygon)
.weight(function (d) {
return d.value;
Expand Down

0 comments on commit d3c848f

Please sign in to comment.