diff --git a/src/axis.jl b/src/axis.jl index 4e0f7e33..84fb8688 100644 --- a/src/axis.jl +++ b/src/axis.jl @@ -148,7 +148,7 @@ Base.keys(ax::AbstractAxis) = keys(indexmap(ax)) reindex(i, offset) = i .+ offset reindex(ax::FlatAxis, _) = ax reindex(ax::Axis, offset) = Axis(map(x->reindex(x, offset), indexmap(ax))) -reindex(ax::ViewAxis, offset) = ViewAxis(viewindex(ax) .+ offset, indexmap(ax)) +reindex(ax::ViewAxis, offset) = ViewAxis(viewindex(ax) .+ offset, ax.ax) # Get AbstractAxis index @inline Base.getindex(::AbstractAxis, idx) = ComponentIndex(idx) diff --git a/test/runtests.jl b/test/runtests.jl index a43843ae..3801ef01 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -590,6 +590,13 @@ end # Issue #100 chol = cholesky(cmat + I) @test convert(Cholesky{Float32,Matrix{Float32}}, chol).factors isa Matrix{Float32} + + # Issue #134 + boid = ComponentArray(pos=zeros(2), vel=zeros(2)) + u0 = ComponentArray(boids=repeat([boid], 2)) + u0.boids + tmp = u0[KeepIndex(:boids)] + @test tmp.boids == u0.boids end @testset "Autodiff" begin