@@ -511,29 +511,33 @@ it will not update the limits. Call update_limits!(scene, automatic) for that.
511511"""
512512update_limits! (scene:: Scene ) = update_limits! (scene, scene. limits[])
513513
514- function update_limits! (scene:: Scene , limits:: Automatic , padding = scene. padding[])
514+ function update_limits! (scene:: Scene , limits:: Automatic , padding:: Vec3f0 = scene. padding[])
515515 # for when scene is empty
516516 dlimits = data_limits (scene)
517517 dlimits === nothing && return # nothing to limit if there isn't anything
518518 tlims = (minimum (dlimits), maximum (dlimits))
519- if ! all (x-> all (isfinite, x), tlims)
520- @warn " limits of scene contain non finite values: $(tlims[1 ]) .. $(tlims[2 ]) "
521- mini = map (x-> ifelse (isfinite (x), x, 0.0 ), tlims[1 ])
522- maxi = Vec3f0 (ntuple (3 ) do i
523- x = tlims[2 ][i]
524- ifelse (isfinite (x), x, tlims[1 ][i] + 1f0 )
525- end )
519+ let avec = tlims[1 ], bvec = tlims[2 ]
520+ if ! all (x-> all (isfinite, x), (avec, bvec))
521+ @warn " limits of scene contain non finite values: $(avec) .. $(bvec) "
522+ mini = map (x-> ifelse (isfinite (x), x, zero (x)), avec)
523+ maxi = Vec3f0 (ntuple (3 ) do i
524+ x = bvec[i]
525+ ifelse (isfinite (x), x, avec[i] + oneunit (avec[i]))
526+ end )
527+ end
526528 tlims = (mini, maxi)
527529 end
528- new_widths = Vec3f0 (ntuple (3 ) do i
529- a = tlims[1 ][i]; b = tlims[2 ][i]
530- w = b - a
531- # check for widths == 0.0... 3rd dimension is allowed to be 0 though.
532- # TODO maybe we should allow any one dimension to be 0, and then use the other 2 as 2D
533- with0 = (i != 3 ) && (w ≈ 0.0 )
534- with0 && @warn " Founds 0 width in scene limits: $(tlims[1 ]) .. $(tlims[2 ]) "
535- ifelse (with0, 1f0 , w)
536- end )
530+ let avec = tlims[1 ], bvec = tlims[2 ]
531+ new_widths = Vec3f0 (ntuple (3 ) do i
532+ a = avec[i]; b = bvec[i]
533+ w = b - a
534+ # check for widths == 0.0... 3rd dimension is allowed to be 0 though.
535+ # TODO maybe we should allow any one dimension to be 0, and then use the other 2 as 2D
536+ with0 = (i != 3 ) && (w ≈ 0.0 )
537+ with0 && @warn " Founds 0 width in scene limits: $(avec) .. $(bvec) "
538+ ifelse (with0, 1f0 , w)
539+ end )
540+ end
537541 update_limits! (scene, FRect3D (tlims[1 ], new_widths), padding)
538542end
539543
@@ -550,7 +554,7 @@ and in three dimensions as a vector of the width (x-axis), breadth (y-axis), and
550554Such a `Rect` can be constructed using the `FRect` or `FRect3D` functions that are exported by
551555`AbstractPlotting.jl`. See their documentation for more information.
552556"""
553- function update_limits! (scene:: Scene , new_limits:: Rect , padding = scene. padding[])
557+ function update_limits! (scene:: Scene , new_limits:: Rect , padding:: Vec3f0 = scene. padding[])
554558 lims = FRect3D (new_limits)
555559 lim_w = widths (lims)
556560 # use the smallest widths for scaling, to have a consistently wide padding for all sides
0 commit comments