Skip to content

Commit 44f775b

Browse files
authored
Fix out-of-bounds inspection of 2d plots (#1092)
* Fix out-of-bounds inspection of 2d plots * Update Project.toml
1 parent fbb208d commit 44f775b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Agents"
22
uuid = "46ada45e-f475-11e8-01d0-f70cc89e6671"
33
authors = ["George Datseris", "Tim DuBois", "Aayush Sabharwal", "Ali Vahdati", "Adriano Meligrana"]
4-
version = "6.1.8"
4+
version = "6.1.9"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

ext/AgentsVisualizations/src/spaces/grid.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ end
2424

2525
## Inspection
2626

27-
Agents.convert_element_pos(::S, pos) where {S<:Agents.AbstractGridSpace} =
28-
Tuple(round.(Int, pos)) # using round to handle positions with offset
29-
27+
function Agents.convert_element_pos(s::S, pos) where {S<:Agents.AbstractGridSpace}
28+
gridpos = pos[1:length(spacesize(s))]
29+
Tuple(round.(Int, gridpos)) # using round to handle positions with offset
30+
end
3031
function Agents.ids_to_inspect(model::ABM{<:GridSpaceSingle}, pos)
3132
id = id_in_position(pos, model)
3233
return id == 0 ? () : (id,)

0 commit comments

Comments
 (0)