mirror of
https://github.com/bendtherules/react-vis-gridarea.git
synced 2026-08-18 22:02:23 +00:00
Fix horizontal verticakl logic
This commit is contained in:
+14
-8
@@ -78,9 +78,14 @@ class GridArea extends PureComponent<GridAreaProps, {}> {
|
|||||||
const style = {...GridArea.defaultStyle, ...this.props.style};
|
const style = {...GridArea.defaultStyle, ...this.props.style};
|
||||||
|
|
||||||
const isVertical = (this.props.direction === Direction.VERTICAL);
|
const isVertical = (this.props.direction === Direction.VERTICAL);
|
||||||
const tickXAttr = isVertical ? 'y' : 'x';
|
|
||||||
const tickYAttr = isVertical ? 'x' : 'y';
|
const primaryAxisName = isVertical ? 'y' : 'x';
|
||||||
const length = isVertical ? height : width;
|
const crossAxisName = isVertical ? 'x' : 'y';
|
||||||
|
const primaryLengthAttr = isVertical ? 'height' : 'width';
|
||||||
|
const crossLengthAttr = isVertical ? 'width' : 'height';
|
||||||
|
const primaryLength = isVertical ? height : width;
|
||||||
|
const crossLength = isVertical ? width : height;
|
||||||
|
|
||||||
|
|
||||||
const scale = getAttributeScale({
|
const scale = getAttributeScale({
|
||||||
...this.props,
|
...this.props,
|
||||||
@@ -88,7 +93,7 @@ class GridArea extends PureComponent<GridAreaProps, {}> {
|
|||||||
height,
|
height,
|
||||||
top,
|
top,
|
||||||
left
|
left
|
||||||
}, 'y');
|
}, primaryAxisName);
|
||||||
const values = this.props.highlightRegion;
|
const values = this.props.highlightRegion;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -105,11 +110,12 @@ class GridArea extends PureComponent<GridAreaProps, {}> {
|
|||||||
const maxPos = Math.max(...pos);
|
const maxPos = Math.max(...pos);
|
||||||
|
|
||||||
const rectProps = {
|
const rectProps = {
|
||||||
x: 0,
|
[crossAxisName]: 0,
|
||||||
width: width,
|
[crossLengthAttr]: crossLength,
|
||||||
y: minPos,
|
[primaryAxisName]: minPos,
|
||||||
height: maxPos - minPos,
|
[primaryLengthAttr]: maxPos - minPos,
|
||||||
};
|
};
|
||||||
|
debugger;
|
||||||
return (
|
return (
|
||||||
<rect
|
<rect
|
||||||
{...rectProps}
|
{...rectProps}
|
||||||
|
|||||||
Reference in New Issue
Block a user