Skip to content

Commit

Permalink
Ensure Card collapsible icon offset is computed robustly (#2940)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Nov 22, 2021
1 parent 68dfa60 commit eeefd2d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions panel/models/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ export class CardView extends ColumnView {
const obbox = header.layout.bbox
const ibbox = header.layout.inner_bbox
if (obbox.x1 != 0) {
const icon_style = getComputedStyle(this.button_el.children[0])
const offset = parseFloat(icon_style.width) + parseFloat(icon_style.marginLeft)
let offset: number
if (this.model.collapsible) {
const icon_style = getComputedStyle(this.button_el.children[0])
offset = (parseFloat(icon_style.width) + parseFloat(icon_style.marginLeft)) || 0
} else {
offset = 0
}
const outer = new BBox({x0: obbox.x0, x1: obbox.x1-offset, y0: obbox.y0, y1: obbox.y1})
const inner = new BBox({x0: ibbox.x0, x1: ibbox.x1-offset, y0: ibbox.y0, y1: ibbox.y1})
header.layout.set_geometry(outer, inner)
Expand Down

0 comments on commit eeefd2d

Please sign in to comment.