File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,12 @@ class TimeSlider extends EventEmitter
5555
5656 # default options and other variables for later
5757 if @useBBox
58- @options .width = @svg [0 ][0 ].getBBox ().width
59- @options .height = @svg [0 ][0 ].getBBox ().height
58+ if @svg [0 ][0 ].getBoundingClientRect
59+ @options .width = @svg [0 ][0 ].getBoundingClientRect ().width
60+ @options .height = @svg [0 ][0 ].getBoundingClientRect ().height
61+ else
62+ @options .width = @svg [0 ][0 ].getBBox ().width
63+ @options .height = @svg [0 ][0 ].getBBox ().height
6064 else
6165 @options .width = @svg [0 ][0 ].clientWidth
6266 @options .height = @svg [0 ][0 ].clientHeight
@@ -240,9 +244,16 @@ class TimeSlider extends EventEmitter
240244 .on (' resize' , =>
241245 # update the width of the element and the scales
242246 svg = d3 .select (@element ).select (' svg.timeslider' )[0 ][0 ]
243- @options .width = if @useBBox then svg .getBBox ().width else svg .clientWidth
244- @scales .x .range ([0 , @options .width ])
245247
248+ if @useBBox
249+ if svg .getBoundingClientRect
250+ @options .width = svg .getBoundingClientRect ().width
251+ else
252+ @options .width = svg .getBBox ().width
253+ else
254+ @options .width = svg .clientWidth
255+
256+ @scales .x .range ([0 , @options .width ])
246257 @ redraw ()
247258 )
248259
You can’t perform that action at this time.
0 commit comments