Skip to content

Commit 260b8f4

Browse files
committed
edit get_mouse
1 parent b83953e commit 260b8f4

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/opengeodeweb_viewer/rpc/viewer/schemas/get_mouse.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
"schema": {
44
"type": "object",
55
"properties": {
6-
"mouse_ids": {
7-
"type": "array",
8-
"items": {
9-
"type": "string"
10-
}
6+
"x": {
7+
"type": "number"
8+
},
9+
"y": {
10+
"type": "number"
1111
}
1212
},
1313
"required": [
14-
"mouse_ids"
14+
"x",
15+
"y"
1516
]
1617
}
1718
}

src/opengeodeweb_viewer/rpc/viewer/viewer_protocols.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,8 @@ def reset(self, params):
151151
def getMouse(self, params):
152152
print(self.schemas_dict["get_mouse"]["rpc"], f"{params=}", flush=True)
153153
validate_schema(params, self.schemas_dict["get_mouse"])
154-
mouse_ids = params["mouse_ids"]
154+
x = params["x"]
155+
y = params["y"]
156+
mouse_ids = self.get_object_ids_at_position(x, y)
157+
155158
return {"mouse_ids": mouse_ids}

src/tests/test_viewer_protocols.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ def test_take_screenshot(server):
140140
def test_get_mouse(server):
141141
server.call(
142142
VtkViewerView.prefix + VtkViewerView.schemas_dict["get_mouse"]["rpc"],
143-
[{"mouse_ids": ["id1", "id2", "id3"]}],
143+
[{"x": 100, "y": 200}],
144144
)
145145
response = server.get_response()
146-
147146
assert "mouse_ids" in response["result"]
148147

149148
mouse_ids = response["result"]["mouse_ids"]
150149
assert isinstance(mouse_ids, list)
151-
assert set(mouse_ids) == {"id1", "id2", "id3"}
150+
assert isinstance(mouse_ids[0], str)
151+
assert len(mouse_ids) > 0

0 commit comments

Comments
 (0)