gdharness 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,14 +162,22 @@ func click(params: Dictionary) -> Dictionary:
162
162
  var centre: Vector2 = control.get_global_transform_with_canvas() * (control.size * 0.5)
163
163
  var position: Vector2 = viewport.get_final_transform() * centre
164
164
  # The GUI only delivers to what is inside the viewport, so a centre outside it would be a
165
- # click that silently reached nothing.
165
+ # click that silently reached nothing. A game with no window has a 64 by 64 viewport
166
+ # whatever the project settings say, which is the usual reason to be here and is not
167
+ # something the caller can read off the rect on its own.
166
168
  if not viewport.get_visible_rect().has_point(centre):
169
+ var why: String = ""
170
+ if not _host.get_tree().root.can_draw():
171
+ why = (
172
+ ". This game has no window, and a game with no window has a 64 by 64 viewport "
173
+ + "whatever the project settings say: run it with a window to reach this control"
174
+ )
167
175
  return {
168
176
  "type": "error",
169
177
  "message":
170
178
  (
171
- "%s has its centre at %s, outside the viewport %s, so nothing can click it"
172
- % [node_path, centre, viewport.get_visible_rect()]
179
+ "%s has its centre at %s, outside the viewport %s, so nothing can click it%s"
180
+ % [node_path, centre, viewport.get_visible_rect(), why]
173
181
  )
174
182
  }
175
183
  var button: int = _resolve_mouse_button(params.get("button", MOUSE_BUTTON_LEFT))