@@ -989,16 +989,21 @@ export lens!
989989 xscale = sp[:xaxis][:scale]
990990 yscale = sp[:yaxis][:scale]
991991 xl1, xl2 = xlims(sp)
992- bbx1 = xl1 + left(inset_bbox). value * (xl2 - xl1)
993- bbx2 = bbx1 + width(inset_bbox). value * (xl2 - xl1)
992+ xls1, xls2 = RecipesPipeline. scale_func(xscale). ((xl1, xl2))
993+ bbx1 = xls1 + left(inset_bbox). value * (xls2 - xls1)
994+ bbx2 = bbx1 + width(inset_bbox). value * (xls2 - xls1)
994995 yl1, yl2 = ylims(sp)
995- bby1 = yl1 + (1 - bottom(inset_bbox). value) * (yl2 - yl1)
996- bby2 = bby1 + height(inset_bbox). value * (yl2 - yl1)
997- bbx = bbx1 + width(inset_bbox). value * (xl2 - xl1) / 2 * (sp[:xaxis][:flip] ? - 1 : 1 )
998- bby = bby1 + height(inset_bbox). value * (yl2 - yl1) / 2 * (sp[:yaxis][:flip] ? - 1 : 1 )
996+ yls1, yls2 = RecipesPipeline. scale_func(yscale). ((yl1, yl2))
997+ bby1 = yls1 + (1 - bottom(inset_bbox). value) * (yls2 - yls1)
998+ bby2 = bby1 + height(inset_bbox). value * (yls2 - yls1)
999+ bbx = bbx1 + width(inset_bbox). value * (xls2 - xls1) / 2 * (sp[:xaxis][:flip] ? - 1 : 1 )
1000+ bby = bby1 + height(inset_bbox). value * (yls2 - yls1) / 2 * (sp[:yaxis][:flip] ? - 1 : 1 )
9991001 lens_index = last(plt. subplots)[:subplot_index] + 1
1000- x1, x2 = RecipesPipeline. inverse_scale_func(xscale). (plotattributes[:x])
1001- y1, y2 = RecipesPipeline. inverse_scale_func(yscale). (plotattributes[:y])
1002+ x1, x2 = plotattributes[:x]
1003+ y1, y2 = plotattributes[:y]
1004+ xs1, xs2 = RecipesPipeline. scale_func(xscale). ((x1, x2))
1005+ ys1, ys2 = RecipesPipeline. scale_func(yscale). ((y1, y2))
1006+
10021007 backup = copy(plotattributes)
10031008 empty!(plotattributes)
10041009
@@ -1012,28 +1017,30 @@ export lens!
10121017 if haskey(backup, :linewidth)
10131018 linewidth := backup[:linewidth]
10141019 end
1015- bbx_mag = (x1 + x2 ) / 2
1016- bby_mag = (y1 + y2 ) / 2
1020+ bbx_mag = (xs1 + xs2 ) / 2
1021+ bby_mag = (ys1 + ys2 ) / 2
10171022 xi_lens, yi_lens =
10181023 intersection_point(bbx_mag, bby_mag, bbx, bby, abs(bby2 - bby1), abs(bbx2 - bbx1))
10191024 xi_mag, yi_mag =
10201025 intersection_point(bbx, bby, bbx_mag, bby_mag, abs(y2 - y1), abs(x2 - x1))
1026+ xi_mag, xi_lens = RecipesPipeline. inverse_scale_func(xscale). ((xi_mag, xi_lens))
1027+ yi_mag, yi_lens = RecipesPipeline. inverse_scale_func(yscale). ((yi_mag, yi_lens))
10211028 # add lines
10221029 if xl1 < xi_lens < xl2 && yl1 < yi_lens < yl2
10231030 @series begin
10241031 primary := false
10251032 subplot := sp_index
1026- x := RecipesPipeline . scale_func(xscale) . ([xi_mag, xi_lens])
1027- y := RecipesPipeline . scale_func(yscale) . ([yi_mag, yi_lens])
1033+ x := ([xi_mag, xi_lens])
1034+ y := ([yi_mag, yi_lens])
10281035 ()
10291036 end
10301037 end
10311038 # add magnification shape
10321039 @series begin
10331040 primary := false
10341041 subplot := sp_index
1035- x := RecipesPipeline . scale_func(xscale) . ([x1, x1, x2, x2, x1])
1036- y := RecipesPipeline . scale_func(yscale) . ([y1, y2, y2, y1, y1])
1042+ x := ([x1, x1, x2, x2, x1])
1043+ y := ([y1, y2, y2, y1, y1])
10371044 ()
10381045 end
10391046 # add subplot
@@ -1042,8 +1049,8 @@ export lens!
10421049 plotattributes = merge(backup, copy(series. plotattributes))
10431050 subplot := lens_index
10441051 primary := false
1045- xlims := RecipesPipeline . scale_func(xscale) . (( x1, x2) )
1046- ylims := RecipesPipeline . scale_func(yscale) . (( y1, y2) )
1052+ xlims := ( x1, x2)
1053+ ylims := ( y1, y2)
10471054 ()
10481055 end
10491056 end
0 commit comments