From 469ab8a6bf49bd4c502321d54969fbf98446db68 Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Sun, 15 Mar 2020 02:52:54 +1100 Subject: [PATCH] fix: check for showStipes option when getting DOM sizes in ClusterItem (#374) Co-authored-by: Yotam Berkowitz --- lib/timeline/component/item/ClusterItem.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/timeline/component/item/ClusterItem.js b/lib/timeline/component/item/ClusterItem.js index e70d956c54..127f0a9627 100644 --- a/lib/timeline/component/item/ClusterItem.js +++ b/lib/timeline/component/item/ClusterItem.js @@ -533,23 +533,28 @@ class ClusterItem extends Item { * @return {object} */ _getDomComponentsSizes() { - return { + const sizes = { previous: { right: this.dom.box.style.right, left: this.dom.box.style.left }, - dot: { - height: this.dom.dot.offsetHeight, - width: this.dom.dot.offsetWidth - }, - line: { - width: this.dom.line.offsetWidth - }, box: { width: this.dom.box.offsetWidth, height: this.dom.box.offsetHeight }, + }; + + if (this.options.showStipes) { + sizes.dot = { + height: this.dom.dot.offsetHeight, + width: this.dom.dot.offsetWidth + }; + sizes.line = { + width: this.dom.line.offsetWidth + }; } + + return sizes; } /**