layerchart 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/scales.js +1 -1
package/package.json
CHANGED
package/utils/scales.js
CHANGED
|
@@ -14,7 +14,7 @@ import { motionStore } from '../stores/motionStore';
|
|
|
14
14
|
export function scaleBandInvert(scale) {
|
|
15
15
|
const domain = scale.domain();
|
|
16
16
|
const eachBand = scale.step();
|
|
17
|
-
const paddingOuter = eachBand * scale.paddingOuter(); //
|
|
17
|
+
const paddingOuter = eachBand * (scale.paddingOuter?.() ?? scale.padding()); // `scaleBand` uses paddingOuter(), while `scalePoint` uses padding() for outer paddding - https://github.com/d3/d3-scale#point_padding
|
|
18
18
|
return function (value) {
|
|
19
19
|
// TODO: Should this use Math.round to better select? https://stackoverflow.com/questions/38633082/d3-getting-invert-value-of-band-scales/50846323#comment104743795_50846323
|
|
20
20
|
const index = Math.floor((value - paddingOuter) / eachBand);
|