gdharness 0.6.6 → 0.6.7

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.
@@ -299,6 +299,24 @@ static func _centre_of(control: Control) -> Vector2:
299
299
  ## the control within the outer one, so the outer has to be asked after the inner has finished
300
300
  ## moving it. A control with no ScrollContainer over it moves nothing and answers false, which is
301
301
  ## what keeps the refusal below saying the right thing about a control that is simply off screen.
302
+ ## Whether [param centre] is somewhere a click can reach it: inside the viewport, and inside every
303
+ ## ScrollContainer between the control and the root, each of which clips what it holds.
304
+ static func _in_sight(control: Control, viewport: Viewport, centre: Vector2) -> bool:
305
+ if not viewport.get_visible_rect().has_point(centre):
306
+ return false
307
+ var walking: Node = control.get_parent()
308
+ while walking != null:
309
+ var holder: ScrollContainer = walking as ScrollContainer
310
+ # Carried into the same space the centre is in, which is the canvas rather than the
311
+ # container's own: the two are only the same while nothing above it is transformed.
312
+ if holder != null:
313
+ var seen: Rect2 = holder.get_global_transform_with_canvas() * Rect2(Vector2.ZERO, holder.size)
314
+ if not seen.has_point(centre):
315
+ return false
316
+ walking = walking.get_parent()
317
+ return true
318
+
319
+
302
320
  static func _scroll_into_view(control: Control) -> bool:
303
321
  var moved: bool = false
304
322
  var walking: Node = control.get_parent()
@@ -341,12 +359,17 @@ func click(params: Dictionary) -> Dictionary:
341
359
  var viewport: Viewport = _clicking_viewport(control)
342
360
  var centre: Vector2 = _centre_of(control)
343
361
 
344
- # A control below the fold of a ScrollContainer is not out of reach, it is one scroll away,
362
+ # A control out of sight inside a ScrollContainer is not out of reach, it is one scroll away,
345
363
  # which is what a person does without thinking about it before they click. Refusing it
346
364
  # instead sent callers to emit the button's own signal, which presses nothing, runs none of
347
365
  # the input path and reports success.
366
+ #
367
+ # Out of sight against what it is clipped to rather than against the viewport: a row scrolled
368
+ # off the top of its container is inside the viewport, behind whatever is drawn up there, so
369
+ # the click went to that instead and said so. Measured on a hall whose staff panel had been
370
+ # scrolled past: the button was at y 69 and its container started at y 166.
348
371
  var scrolled: bool = false
349
- if not viewport.get_visible_rect().has_point(centre):
372
+ if not _in_sight(control, viewport, centre):
350
373
  scrolled = _scroll_into_view(control)
351
374
  if scrolled:
352
375
  # A container moves its child on the next layout pass rather than inside the call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",