add slice_arg for AbstractRange

This commit is contained in:
Moelf 2020-10-02 15:08:59 -04:00
parent b8222b46fe
commit 994b543add

View File

@ -1238,6 +1238,7 @@ convertLegendValue(v::AbstractArray) = map(convertLegendValue, v)
# 1-row matrices will give an element
# multi-row matrices will give a column
# InputWrapper just gives the contents
# AbstractRange gives (first, last) tuple
# anything else is returned as-is
function slice_arg(v::AMat, idx::Int)
c = mod1(idx, size(v,2))
@ -1245,6 +1246,7 @@ function slice_arg(v::AMat, idx::Int)
size(v,1) == 1 ? v[first(m),n[c]] : v[:,n[c]]
end
slice_arg(wrapper::InputWrapper, idx) = wrapper.obj
slice_arg(v::AbstractRange, idx) = (first(v), last(v))
slice_arg(v, idx) = v