Skip to content

Commit

Permalink
Merge pull request #3 from Runtus/interval-min-height
Browse files Browse the repository at this point in the history
fix: cancel the maxHeight type and format the code style
  • Loading branch information
iamzone authored Nov 7, 2023
2 parents 922f647 + 9882299 commit b25c03a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 37 deletions.
28 changes: 14 additions & 14 deletions __tests__/plots/static/alphanbet-interval-min-height-transposed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ export function alphabetIntervalMinHeightTransposed(): G2Spec {
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
],
encode: {
x: "genre",
y: "sold",
color: "genre"
},
axis: {
x: { animate: false },
y: { animate: false }
},
style: {
draggable: true,
droppable: true,
minHeight: 50
}
encode: {
x: 'genre',
y: 'sold',
color: 'genre',
},
axis: {
x: { animate: false },
y: { animate: false },
},
style: {
draggable: true,
droppable: true,
minHeight: 50,
},
};
}
28 changes: 14 additions & 14 deletions __tests__/plots/static/alphanbet-interval-min-height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ export function alphabetIntervalMinHeight(): G2Spec {
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
],
encode: {
x: "genre",
y: "sold",
color: "genre"
},
axis: {
x: { animate: false },
y: { animate: false }
},
style: {
draggable: true,
droppable: true,
minHeight: 50
}
encode: {
x: 'genre',
y: 'sold',
color: 'genre',
},
axis: {
x: { animate: false },
y: { animate: false },
},
style: {
draggable: true,
droppable: true,
minHeight: 50,
},
};
}
4 changes: 2 additions & 2 deletions __tests__/plots/static/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export { alphabetIntervalMaxWidth } from './alphabet-interval-max-width';
export { alphabetIntervalMinWidth } from './alphabet-interval-min-width';
export { alphabetIntervalMaxWidthTransposed } from './alphabet-interval-max-width-transposed';
export { alphabetIntervalMinWidthTransposed } from './alphabet-interval-min-width-transposed';
export { alphabetIntervalMinHeight } from './alphanbet-interval-min-height'
export { alphabetIntervalMinHeightTransposed } from './alphanbet-interval-min-height-transposed'
export { alphabetIntervalMinHeight } from './alphanbet-interval-min-height';
export { alphabetIntervalMinHeightTransposed } from './alphanbet-interval-min-height-transposed';
export { alphabetIntervalTitle } from './alphabet-interval-title';
export { alphabetIntervalLabelOverflowHide } from './alphabet-interval-label-overflow-hide';
export { alphabetIntervalLabelContrastReverse } from './alphabet-interval-label-contrast-reverse';
Expand Down
6 changes: 4 additions & 2 deletions src/shape/interval/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export function rect(
? clamp(finalHeight, minWidth, maxWidth)
: clamp(finalHeight, minHeight, Infinity);
const clampX = tpShape ? finalX : finalX - (clampWidth - finalWidth) / 2;
const clampY = tpShape ? finalY - (clampHeight - finalHeight ) / 2 : finalY - (clampHeight - finalHeight);
const clampY = tpShape
? finalY - (clampHeight - finalHeight) / 2
: finalY - (clampHeight - finalHeight);

return select(document.createElement('rect', {}))
.style('x', clampX)
Expand Down Expand Up @@ -188,7 +190,7 @@ export const Color: SC<ColorOptions> = (options, context) => {
insetTop,
minWidth,
maxWidth,
minHeight
minHeight,
};

return (
Expand Down
5 changes: 0 additions & 5 deletions src/shape/interval/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export type RectOptions = {
* Minimum height of each interval.
*/
minHeight?: number;

/**
* Minimum height of each interval.
*/
maxHeight?: number;
};

/**
Expand Down

0 comments on commit b25c03a

Please sign in to comment.