Skip to content

Commit

Permalink
Fix out-of-bounds inspection of 2d plots (#1092)
Browse files Browse the repository at this point in the history
* Fix out-of-bounds inspection of 2d plots

* Update Project.toml
  • Loading branch information
Tortar authored Oct 10, 2024
1 parent fbb208d commit 44f775b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Agents"
uuid = "46ada45e-f475-11e8-01d0-f70cc89e6671"
authors = ["George Datseris", "Tim DuBois", "Aayush Sabharwal", "Ali Vahdati", "Adriano Meligrana"]
version = "6.1.8"
version = "6.1.9"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
7 changes: 4 additions & 3 deletions ext/AgentsVisualizations/src/spaces/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ end

## Inspection

Agents.convert_element_pos(::S, pos) where {S<:Agents.AbstractGridSpace} =
Tuple(round.(Int, pos)) # using round to handle positions with offset

function Agents.convert_element_pos(s::S, pos) where {S<:Agents.AbstractGridSpace}
gridpos = pos[1:length(spacesize(s))]
Tuple(round.(Int, gridpos)) # using round to handle positions with offset
end
function Agents.ids_to_inspect(model::ABM{<:GridSpaceSingle}, pos)
id = id_in_position(pos, model)
return id == 0 ? () : (id,)
Expand Down

0 comments on commit 44f775b

Please sign in to comment.