IconPanel: force 100% size (#40961)

This commit is contained in:
Ryan McKinley 2021-10-27 08:21:09 -07:00 committed by GitHub
parent 5c72f3adbe
commit f52ec5e5b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,11 +27,26 @@ export class IconPanel extends Component<Props> {
initElement = (props: Props) => {
this.element = new ElementState(iconItem, props.options.root as any);
this.element.updateSize(props.width, props.height);
this.updateSize(props);
this.element.updateData(this.dims);
return this.element;
};
updateSize = (props: Props) => {
const { width, height } = props;
this.element.anchor = {
top: true,
left: true,
};
this.element.placement = {
left: 0,
top: 0,
width,
height,
};
this.element.updateSize(width, height);
};
dims: DimensionContext = {
getColor: (color: ColorDimensionConfig) => getColorDimensionFromData(this.props.data, color),
getScale: (scale: ScaleDimensionConfig) => getScaleDimensionFromData(this.props.data, scale),
@ -44,7 +59,7 @@ export class IconPanel extends Component<Props> {
let changed = false;
if (width !== nextProps.width || height !== nextProps.height) {
this.element.updateSize(nextProps.width, nextProps.height);
this.updateSize(nextProps);
changed = true;
}
if (data !== nextProps.data) {