@papercraftgames/estragon 0.1.0-beta.32 → 0.1.0-beta.34

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.
@@ -3,5 +3,5 @@
3
3
  name="Estragon"
4
4
  description="Native Gogo/GGX highlighting, compilation and validation before Play."
5
5
  author="Resist Design"
6
- version="0.1.0-beta.32"
6
+ version="0.1.0-beta.34"
7
7
  script="plugin.gd"
@@ -373,6 +373,12 @@ func _apply(desired: Element, record: Mounted) -> void:
373
373
  node._apply_grid(_grid_config(desired))
374
374
  var stack := StackContract.registered(desired.type)
375
375
  var scroll := VisualStyle.marked(desired.type,"ESTRAGON_SCROLL_2D")
376
+ if scroll:
377
+ for key in ["scrollbar_size","vertical_scrollbar_width","horizontal_scrollbar_height","scrollbar_style"]:
378
+ if record.properties.has(key) and not desired.properties.has(key) and not resets.has(key):
379
+ node.set(key,record.defaults[key])
380
+ writes += 1
381
+ if Profile.is_enabled(): Profile.add("property_writes")
376
382
  if stack:
377
383
  var policy := resets.duplicate()
378
384
  policy.merge(desired.properties,true)
@@ -616,6 +622,9 @@ func _preflight(desired, previous, parent: Node, contracts: Variant = null) -> b
616
622
  validation_error = desired.location(key)+": "+message+"; previous tree retained"
617
623
  return false
618
624
  if VisualStyle.marked(desired.type,"ESTRAGON_SCROLL_2D"):
625
+ if desired.properties.has("scrollbar_style"):
626
+ var problem := preload("../node/internal/scrollbar_style.gd").error(desired.properties.scrollbar_style)
627
+ if not problem.is_empty(): return _invalid_attribute(desired,"scrollbar_style",problem)
619
628
  if desired.properties.has("scroll_offset") and not preload("../node/internal/scroll_2d.gd").valid_offset(desired.properties.scroll_offset): return _invalid_attribute(desired,"scroll_offset","requires a finite nonnegative Vector2")
620
629
  for key in ["scroll_range","content_extent"]:
621
630
  if desired.properties.has(key): return _invalid_attribute(desired,key,"read-only scrolling measurement")
@@ -44,6 +44,11 @@ func update(view: Node) -> void:
44
44
  if target != null: target.model.invalidated.connect(_configure)
45
45
  layout._sync()
46
46
  _configure()
47
+ # A root may become a participant after an initially empty/plain boundary.
48
+ # Parent gap counts follow that logical participation, not the host Node.
49
+ if layout._dimension==2:
50
+ var parent = layout.parent_coordinator()
51
+ if parent!=null: parent._sync()
47
52
  func _configure() -> void:
48
53
  if layout == null or not layout.active: return
49
54
  var requested := Vector3(-1,-1,0) if layout._dimension==2 else Vector3(-1,-1,-1)
@@ -11,6 +11,31 @@ const ESTRAGON_MINIMUMS_2D := true
11
11
  const ESTRAGON_GAPS_2D := true
12
12
  const ESTRAGON_SCROLL_2D := true
13
13
  const Scroll = preload("internal/scroll_2d.gd")
14
+ const ScrollbarStyle = preload("internal/scrollbar_style.gd")
15
+ var scrollbar_size = 12:
16
+ set(value):
17
+ if is_same(scrollbar_size,value) or not lengths.assign("scrollbar_size",value): return
18
+ scrollbar_size = value
19
+ _changed()
20
+ var vertical_scrollbar_width = "auto":
21
+ set(value):
22
+ if is_same(vertical_scrollbar_width,value) or not lengths.assign("vertical_scrollbar_width",value): return
23
+ vertical_scrollbar_width = value
24
+ _changed()
25
+ var horizontal_scrollbar_height = "auto":
26
+ set(value):
27
+ if is_same(horizontal_scrollbar_height,value) or not lengths.assign("horizontal_scrollbar_height",value): return
28
+ horizontal_scrollbar_height = value
29
+ _changed()
30
+ @export var scrollbar_style: Dictionary = {}:
31
+ set(value):
32
+ var problem := ScrollbarStyle.error(value)
33
+ if not problem.is_empty():
34
+ push_error("Estragon "+problem)
35
+ return
36
+ if scrollbar_style==value: return
37
+ scrollbar_style = value.duplicate(true)
38
+ if _scroll!=null: _scroll.refresh_style()
14
39
  var _scroll
15
40
  @export var clip_content: bool = false:
16
41
  set(value):
@@ -277,6 +302,7 @@ var layout = Coordinator.new(self, 2, Coordinator.Mode.ENTRY if _is_layout_entry
277
302
  func _get_property_list() -> Array[Dictionary]:
278
303
  var properties := Length.properties(["width","height","min_width","min_height","max_width","max_height","x","y","gap","padding","padding_top","padding_right","padding_bottom","padding_left","margin","margin_top","margin_right","margin_bottom","margin_left"])
279
304
  properties.append_array(Length.properties(["row_gap","column_gap"]))
305
+ properties.append_array(Length.properties(Length.SCROLLBAR_SIZES))
280
306
  if VisualStyle.supported(get_script()): properties.append_array(Length.properties(["border_width","border_top_width","border_right_width","border_bottom_width","border_left_width","background_color","border_color"]))
281
307
  if VisualStyle.supported(get_script()): properties.append_array(Length.properties(VisualStyle.RADII))
282
308
  return properties
@@ -303,7 +329,7 @@ func _default_padding() -> Vector4:
303
329
  return Vector4.ZERO
304
330
 
305
331
  func _padding_insets() -> Vector4:
306
- layout.model.prepare(layout.model.parent_reference,layout.model.viewport_size)
332
+ layout.model.prepare(layout.model.parent_reference,layout.model.viewport_size,layout.model.dimension_reference)
307
333
  return layout.model.padding
308
334
 
309
335
  func get_content_rect() -> Rect2:
@@ -387,7 +413,8 @@ func get_layout_stats() -> Dictionary:
387
413
  return {"measure": layout.model.measure_count, "arrange": layout.model.arrange_count, "flush": layout.flush_count, "active": get_layout_root() != null}
388
414
 
389
415
  func apply_layout_position(offset: Vector3) -> void:
390
- position = Vector2(offset.x, offset.y)
416
+ var next := Vector2(offset.x,offset.y)
417
+ if position!=next: position = next
391
418
 
392
419
  func apply_layout_size(size: Vector3) -> void:
393
420
  var next := Vector2(size.x,size.y)
@@ -402,7 +429,7 @@ func apply_layout_size(size: Vector3) -> void:
402
429
  layout_applied.emit(_layout_size)
403
430
 
404
431
  func _margin_insets() -> Vector4:
405
- layout.model.prepare(layout.model.parent_reference,layout.model.viewport_size)
432
+ layout.model.prepare(layout.model.parent_reference,layout.model.viewport_size,layout.model.dimension_reference)
406
433
  return layout.model.margin
407
434
 
408
435
  func _queue_style_redraw() -> void:
@@ -75,7 +75,7 @@ const _GOGO_BINDABLE_PROPERTIES_NATIVE := {"value":"String"}
75
75
  var _editor: LineEdit
76
76
  var _editor_skin := StyleBoxEmpty.new()
77
77
  func _init() -> void:
78
- background_color = Color("#252d38")
78
+ background_color = Color("#383838")
79
79
  padding = 8.0
80
80
  func _measure_native() -> Vector2:
81
81
  # A stable single-line viewport, not a text-dependent expanding field.
@@ -22,6 +22,7 @@ func _init(host: Node, dimension: int, mode: int = Mode.PROOF) -> void:
22
22
  _mode = mode
23
23
  _host = weakref(host)
24
24
  _dimension = dimension
25
+ model.dimension_budget_enabled = dimension==2
25
26
  if _mode == Mode.PROOF: host.set_meta(META, weakref(self))
26
27
  model.invalidated.connect(_invalidated)
27
28
  model.placed.connect(_place)
@@ -104,7 +105,21 @@ func stop() -> void:
104
105
 
105
106
  func _visibility_changed() -> void:
106
107
  var parent = parent_coordinator()
107
- if parent!=null and parent.model.strategy in ["wrap","grid"]: parent._sync()
108
+ while parent!=null:
109
+ parent._sync()
110
+ if parent._mode!=Mode.COMPOSITION: break
111
+ parent = parent.parent_coordinator()
112
+
113
+ func participates() -> bool:
114
+ var host = _host.get_ref()
115
+ if host==null or _dimension==2 and host is CanvasItem and not host.is_visible_in_tree(): return false
116
+ if _mode==Mode.ENTRY: return false
117
+ if _mode==Mode.CONTROL: return control_adapter.participates()
118
+ if _mode==Mode.COMPOSITION:
119
+ var root = managed_root.get_ref() if managed_root!=null else null
120
+ var target = participant(root)
121
+ return target!=null and target.participates()
122
+ return true
108
123
 
109
124
  func _child_entered(child: Node) -> void:
110
125
  if child is Control: CompositionHosts.enter_control(child)
@@ -129,14 +144,18 @@ func _sync() -> void:
129
144
  # Native child-entered signals can precede internal-child bookkeeping.
130
145
  # Runtime GUI endpoints/decorations never become layout participants.
131
146
  if host.has_method("_composition_is_private") and host._composition_is_private(child): continue
132
- if _dimension==2 and model.strategy in ["wrap","grid"] and child is CanvasItem and not child.is_visible_in_tree(): continue
147
+ if _dimension==2 and child is CanvasItem and not child.is_visible_in_tree(): continue
133
148
  var found = participant(child,true)
134
149
  if found != null and found._mode != Mode.ENTRY:
135
- if found._mode == Mode.CONTROL and not found.control_adapter.participates(): continue
150
+ if _dimension==2 and not found.participates(): continue
136
151
  found.model.set_placement(CompositionHosts.get_placement(child))
137
152
  values.append(found.model)
153
+ var participation_changed := model.children != values
138
154
  var error := model.set_children(values)
139
155
  if error != OK: push_error("Estragon layout model ownership: " + error_string(error))
156
+ if participation_changed and _mode==Mode.COMPOSITION:
157
+ var parent = parent_coordinator()
158
+ if parent!=null: parent._sync()
140
159
 
141
160
  func changed() -> void:
142
161
  var host = _host.get_ref()
@@ -19,10 +19,17 @@ static func tracks(specs: Array, items: Array, placements: Array, axis: int, ref
19
19
  var span: int = rect.column_span if axis==0 else rect.row_span
20
20
  var occupied := gap*(span-1)
21
21
  var eligible: Array = []
22
+ var fractions_only := true
22
23
  for index in range(start,start+span):
23
24
  occupied += sizes[index]
24
25
  if specs[index].unit in ["auto","fr"]: eligible.append(index)
25
- var deficit: float = maxf(0,maxf(items[i].get("contribution",items[i].preferred)[axis],items[i].minimum[axis])+items[i].outer[axis]-occupied)
26
+ if specs[index].unit!="fr": fractions_only = false
27
+ var contribution: float = items[i].get("contribution",items[i].preferred)[axis]
28
+ var viewport_floor: float = items[i].get("scroll_floor",Vector3(-1,-1,-1))[axis]
29
+ # A definite fraction cell assigns a scrolling viewport. Its hidden
30
+ # content is not a minimum viewport size; auto rows remain intrinsic.
31
+ if reference>=0 and fractions_only and viewport_floor>=0: contribution = viewport_floor
32
+ var deficit: float = maxf(0,maxf(contribution,items[i].minimum[axis])+items[i].outer[axis]-occupied)
26
33
  for index in eligible: sizes[index] += deficit/eligible.size()
27
34
  if reference>=0:
28
35
  var budget := reference-gap*maxi(0,sizes.size()-1)
@@ -5,6 +5,7 @@ const WrapPolicy = preload("wrap_policy.gd")
5
5
  const GridDefinition = preload("grid_definition.gd")
6
6
  const GridPolicy = preload("grid_policy.gd")
7
7
  const Length = preload("length.gd")
8
+ const ScrollbarGeometry = preload("scrollbar_geometry.gd")
8
9
  const Profile = preload("../../composition/profile.tres")
9
10
  ## Shared B2/C1 mathematical row layout. No Nodes, rendering or SceneTree dependencies.
10
11
  signal invalidated
@@ -18,6 +19,14 @@ var pixels_per_unit: float = 1.0
18
19
  var length_offset := Vector3.ZERO
19
20
  var viewport_size := Vector2.ZERO
20
21
  var parent_reference := Vector3(-1,-1,-1)
22
+ # Width/height percentages alone use this parent-policy budget. Other Length
23
+ # domains retain parent_reference; spatial coordinators keep their old contract.
24
+ var dimension_reference := Vector3(-1,-1,-1)
25
+ var dimension_budget_enabled := true
26
+ var _dimension_axes := Vector3.ZERO
27
+ var _budget_context: Array = []
28
+ var _budget := Vector3(-1,-1,-1)
29
+ var dimension_budget_count := 0
21
30
  var resolution_count := 0
22
31
  var _length_context: Array = []
23
32
  var _parent_axes := Vector3.ZERO
@@ -36,6 +45,7 @@ var policy_result: Dictionary = {}
36
45
  var strategy := "stack"
37
46
  # Viewport decoration; never replaces Stack/Wrap/Grid.
38
47
  var scroll_axes := Vector2.ZERO
48
+ var scroll_geometry: Dictionary = {}
39
49
  var clips_content := false
40
50
  var align_content := "start"
41
51
  var physical_gaps := Vector2.ZERO
@@ -86,6 +96,9 @@ func set_lengths(specs: Dictionary, growth: float, cross: int, scale: float, sta
86
96
  var dependencies := Length.dependencies(length_specs,stack_axis)
87
97
  _parent_axes = dependencies[0]
88
98
  _viewport_axes = dependencies[1]
99
+ _dimension_axes = Vector3.ZERO
100
+ for index in range(2):
101
+ if length_specs.get(["width","height"][index],{}).get("unit","")=="%": _dimension_axes[index] = 1
89
102
  _length_context = []
90
103
  invalidate()
91
104
 
@@ -120,7 +133,8 @@ func set_align_self(value: String) -> void:
120
133
  func _length(name: String, axis_index: int, fallback: float) -> float:
121
134
  if not length_specs.has(name): return fallback
122
135
  var spec: Dictionary = length_specs[name]
123
- return Length.resolve(spec,parent_reference[axis_index],viewport_size,pixels_per_unit)
136
+ var reference: float = dimension_reference[axis_index] if name in ["width","height"] and spec.unit=="%" else parent_reference[axis_index]
137
+ return Length.resolve(spec,reference,viewport_size,pixels_per_unit)
124
138
 
125
139
  func _warn_unanchored() -> void:
126
140
  if _reported_unanchored: return
@@ -144,20 +158,23 @@ func _edges(prefix: String) -> Vector4:
144
158
 
145
159
  # Resolve specs only on a changed parent/viewport/spec context. No property
146
160
  # writeback, parsing in arrange, subscriptions per length, or frame polling.
147
- func prepare(reference: Vector3, viewport: Vector2) -> void:
148
- if transparent and _forward_context!=[reference,viewport] or viewport_size!=viewport and not children.is_empty():
161
+ func prepare(reference: Vector3, viewport: Vector2, dimensions: Variant = null) -> void:
162
+ var budget: Vector3 = reference if dimensions==null else dimensions
163
+ if transparent and _forward_context!=[reference,viewport,budget] or viewport_size!=viewport and not children.is_empty():
149
164
  _measure_dirty = true
150
165
  _arrange_dirty = true
151
- _forward_context = [reference,viewport] if transparent else []
166
+ _forward_context = [reference,viewport,budget] if transparent else []
152
167
  for index in range(3):
153
168
  if parent_reference[index]!=reference[index] and measurement_allocation[index]>=0:
154
169
  measurement_allocation[index] = -1
155
170
  _measure_dirty = true
156
171
  parent_reference = reference
172
+ dimension_reference = budget
157
173
  viewport_size = viewport
158
- var context := [reference*_parent_axes,viewport*_viewport_axes]
174
+ var context := [reference*_parent_axes,viewport*_viewport_axes,budget*_dimension_axes]
159
175
  if _length_context==context: return
160
176
  _length_context = context
177
+ if dimension_budget_enabled: measurement_allocation = Vector3(-1,-1,-1)
161
178
  resolution_count += 1
162
179
  var before := [requested,gap,physical_gaps,padding,border,margin,length_offset,authored_minimum,authored_maximum]
163
180
  if not length_specs.is_empty():
@@ -199,13 +216,18 @@ func constrain(extent: Vector3) -> Vector3:
199
216
  extent[index] = maxf(extent[index],floor[index])
200
217
  return extent
201
218
 
202
- func _content_basis() -> Vector3:
219
+ func _inner_basis() -> Vector3:
203
220
  var basis := Vector3(-1,-1,-1)
204
221
  for index in range(3):
205
222
  var allocated: float = constrain(requested)[index] if requested[index]>=0 else measurement_allocation[index]
206
223
  if allocated>=0: basis[index] = maxf(0,maxf(allocated,minimum()[index])-leading(padding+border)[index]-trailing(padding+border)[index])
224
+ return basis
225
+
226
+ func _content_basis() -> Vector3:
227
+ var basis := _inner_basis()
228
+ var strips := ScrollbarGeometry.thickness(Vector2(basis.x,basis.y),scroll_axes,length_specs,viewport_size)
207
229
  for index in range(2):
208
- if scroll_axes[index]>0: basis[index] = -1
230
+ if basis[index]>=0: basis[index] = maxf(0,basis[index]-strips[index])
209
231
  return basis
210
232
 
211
233
  static func valid_extent(value: Vector3) -> bool:
@@ -228,7 +250,7 @@ func configure(extent: Vector3, spacing: float, centered: bool, stack_axis: int
228
250
  intrinsic = content
229
251
  requested = extent
230
252
  gap = spacing
231
- physical_gaps = Vector2(spacing,spacing)
253
+ if length_specs.is_empty(): physical_gaps = Vector2(spacing,spacing)
232
254
  center = centered
233
255
  invalidate()
234
256
  return OK
@@ -255,6 +277,7 @@ func set_children(values: Array) -> Error:
255
277
  return OK
256
278
 
257
279
  func invalidate() -> void:
280
+ if dimension_budget_enabled: measurement_allocation = Vector3(-1,-1,-1)
258
281
  _measure_dirty = true
259
282
  _arrange_dirty = true
260
283
  var parent = _parent.get_ref() if _parent != null else null
@@ -283,16 +306,48 @@ func track_contribution() -> Vector3:
283
306
  func _items() -> Array:
284
307
  var items: Array = []
285
308
  for child in children:
286
- items.append({"preferred":child.measured,"contribution":child.track_contribution(),"minimum":child.minimum(),"maximum":child.maximum(),"requested":child.requested,"grow":child.grow,"stretch":child.stretch,"align_self":child.align_self,"fill":child.fill,"outer":child.outer_extent(),"leading":leading(child.margin),"placement":child.placement})
309
+ items.append({"preferred":child.measured,"contribution":child.track_contribution(),"scroll_floor":child.scroll_track_floor(),"minimum":child.minimum(),"maximum":child.maximum(),"requested":child.requested,"grow":child.grow,"stretch":child.stretch,"align_self":child.align_self,"fill":child.fill,"outer":child.outer_extent(),"leading":leading(child.margin),"placement":child.placement})
287
310
  return items
288
311
 
289
- func _grid(items: Array, content: Vector3) -> Dictionary:
312
+ func scroll_track_floor() -> Vector3:
313
+ if transparent and children.size()==1: return children[0].scroll_track_floor()
314
+ var result := Vector3(-1,-1,-1)
315
+ for index in range(2):
316
+ if scroll_axes[index]>0 and requested[index]<0:
317
+ result[index] = maxf(minimum()[index],intrinsic[index]+leading(padding+border)[index]+trailing(padding+border)[index])
318
+ return result
319
+
320
+ func _prepare_grid() -> void:
290
321
  var placements: Array = []
291
- for item in items: placements.append(item.placement)
322
+ for child in children: placements.append(child.placement)
292
323
  if grid_definition.get("source_placements",[])!=placements or grid_definition.is_empty():
293
324
  grid_definition = GridDefinition.configuration(grid_config,placements)
294
325
  grid_definition.source_placements = placements.duplicate(true)
295
326
  if grid_definition.has("error"): push_error("Estragon Grid: "+grid_definition.error+"; previous native slots retained")
327
+
328
+ func dimension_budget(reference: Vector3) -> Vector3:
329
+ if not dimension_budget_enabled or transparent or strategy=="wrap": return reference
330
+ var result := reference
331
+ var counts := Vector2i.ONE
332
+ if strategy=="grid":
333
+ _prepare_grid()
334
+ if grid_definition.has("error"): return reference
335
+ counts = Vector2i(grid_definition.columns.size(),grid_definition.rows.size())
336
+ elif axis<2: counts[axis] = children.size()
337
+ var context := [reference,physical_gaps,counts]
338
+ if _budget_context==context: return _budget
339
+ _budget_context = context
340
+ dimension_budget_count += 1
341
+ for index in range(2):
342
+ if reference[index]>=0: result[index] = maxf(0,reference[index]-physical_gaps[index]*maxi(0,counts[index]-1))
343
+ _budget = result
344
+ return result
345
+
346
+ func _main_gap() -> float:
347
+ return physical_gaps[axis] if axis<2 else gap
348
+
349
+ func _grid(items: Array, content: Vector3) -> Dictionary:
350
+ _prepare_grid()
296
351
  if grid_definition.has("error"):
297
352
  # Native children may exceed an explicitly bounded grid after direct edits.
298
353
  # Reject the layout as a whole, preserving the previous allocated slots.
@@ -321,6 +376,7 @@ func set_capacity(value: Vector3) -> void:
321
376
 
322
377
  func _wrap_basis() -> Vector3:
323
378
  var basis := _content_basis()
379
+ if axis<2 and scroll_axes[axis]>0: basis[axis] = -1
324
380
  if strategy=="wrap" and scroll_axes[axis]==0 and requested[axis]<0 and basis[axis]<0 and available_capacity[axis]>=0:
325
381
  basis[axis] = maxf(0,available_capacity[axis]-leading(padding+border)[axis]-trailing(padding+border)[axis])
326
382
  var cap := maximum()
@@ -333,7 +389,7 @@ func measure_allocated(extent: Vector3, authority: Vector3) -> void:
333
389
  if transparent and children.size()==1:
334
390
  children[0].measure_allocated(extent,authority)
335
391
  _measure_dirty = true
336
- elif strategy in ["wrap","grid"] or scroll_axes!=Vector2.ZERO:
392
+ elif strategy in ["wrap","grid"] or scroll_axes!=Vector2.ZERO or dimension_budget_enabled and not children.is_empty():
337
393
  var next := measurement_allocation
338
394
  for index in range(2):
339
395
  if requested[index]<0 and authority[index]>0: next[index] = extent[index]
@@ -341,7 +397,13 @@ func measure_allocated(extent: Vector3, authority: Vector3) -> void:
341
397
  measurement_allocation = next
342
398
  _measure_dirty = true
343
399
  else: return
400
+ var preferred := measured
344
401
  measure()
402
+ # Allocated axes are not a new intrinsic growth basis. Only the dependent
403
+ # unallocated (e.g. wrapped cross) axes feed back into this bounded pass.
404
+ if dimension_budget_enabled:
405
+ for index in range(2):
406
+ if requested[index]<0 and authority[index]>0: measured[index] = preferred[index]
345
407
 
346
408
  func overflow_extent() -> Vector3:
347
409
  # Ancestors see the clipped participant's viewport, not its hidden content.
@@ -356,7 +418,7 @@ func overflow_extent() -> Vector3:
356
418
  func _slots(items: Array, content: Vector3, definite: Vector3) -> Array:
357
419
  if strategy=="grid": return _grid(items,content).slots
358
420
  if strategy=="wrap": return WrapPolicy.layout(items,content,axis,physical_gaps,alignment,align_content,Vector2(definite.x,definite.y)).slots
359
- return StackPolicy.slots(items,content,axis,physical_gaps[axis] if axis<2 and not length_specs.is_empty() else gap,alignment)
421
+ return StackPolicy.slots(items,content,axis,_main_gap(),alignment)
360
422
 
361
423
  func _authority(child, item: Dictionary, basis: Vector3) -> Vector3:
362
424
  var authority := Vector3.ZERO
@@ -372,7 +434,7 @@ func _authority(child, item: Dictionary, basis: Vector3) -> Vector3:
372
434
  func measure() -> Vector3:
373
435
  if transparent and children.size()==1:
374
436
  var child = children[0]
375
- child.prepare(parent_reference,viewport_size)
437
+ child.prepare(parent_reference,viewport_size,dimension_reference)
376
438
  child.set_capacity(available_capacity)
377
439
  child.measure()
378
440
  if child.requested!=requested or child.grow!=grow or child.stretch!=stretch or child.align_self!=align_self or child.margin!=margin or child.fill!=fill or child.length_offset!=length_offset:
@@ -389,8 +451,9 @@ func measure() -> Vector3:
389
451
  if Profile.is_enabled(): Profile.add("layout_measures")
390
452
  if not transparent:
391
453
  var basis := _content_basis()
454
+ var budget := dimension_budget(basis)
392
455
  for child in children:
393
- child.prepare(basis,viewport_size)
456
+ child.prepare(basis,viewport_size,budget)
394
457
  var capacity := basis
395
458
  for index in range(3):
396
459
  if capacity[index]>=0: capacity[index] = maxf(0,capacity[index]-child.outer_extent()[index])
@@ -404,13 +467,12 @@ func measure() -> Vector3:
404
467
  for index in range(children.size()): children[index].measure_allocated(allocations[index].extent,_authority(children[index],items[index],basis))
405
468
  var natural := Vector3.ZERO
406
469
  for child in children:
407
- if not transparent: child.prepare(_content_basis(),viewport_size)
408
470
  var child_size: Vector3 = child.measure()
409
471
  if not transparent: child_size += child.outer_extent()
410
472
  for index in range(3):
411
473
  if index == axis: natural[index] += child_size[index]
412
474
  else: natural[index] = maxf(natural[index],child_size[index])
413
- if children.size() > 1: natural[axis] += (physical_gaps[axis] if axis<2 and length_specs.has("column_gap") else gap) * (children.size() - 1)
475
+ if children.size() > 1: natural[axis] += _main_gap() * (children.size() - 1)
414
476
  if strategy=="wrap" and not transparent:
415
477
  var basis := _wrap_basis()
416
478
  natural = WrapPolicy.layout(_items(),basis,axis,physical_gaps,alignment,align_content,Vector2(1 if basis.x>=0 else 0,1 if basis.y>=0 else 0)).extent
@@ -445,12 +507,15 @@ func arrange(available: Vector3, external_axes: Vector3 = Vector3.ZERO) -> void:
445
507
  _external_axes = external_axes
446
508
  _warn_unanchored()
447
509
  var content := available-leading(padding+border)-trailing(padding+border)
510
+ for index in range(3): content[index] = maxf(0,content[index])
511
+ var origin := leading(padding+border)
512
+ scroll_geometry = ScrollbarGeometry.snapshot(Rect2(Vector2(origin.x,origin.y),Vector2(content.x,content.y)),scroll_axes,length_specs,viewport_size)
513
+ content.x = scroll_geometry.viewport.size.x
514
+ content.y = scroll_geometry.viewport.size.y
448
515
  var reference := Vector3(-1,-1,-1)
449
516
  for index in range(3):
450
517
  content[index] = maxf(0,content[index])
451
518
  if independent_axis(index): reference[index] = content[index]
452
- for index in range(2):
453
- if scroll_axes[index]>0: reference[index] = -1
454
519
  var changed: bool = reference != content_reference
455
520
  if not _arrange_dirty and size == available and not changed: return
456
521
  content_reference = reference
@@ -484,9 +549,9 @@ func arrange(available: Vector3, external_axes: Vector3 = Vector3.ZERO) -> void:
484
549
  push_warning("Estragon explicit main-axis dimension overrides grow; use auto height/width on a remaining-space Spacer")
485
550
  # Assigned content is authoritative, including grow allocations. Resolve the
486
551
  # immediate children against this box before measuring their slots.
552
+ var budget := dimension_budget(reference)
487
553
  for child in children:
488
- var child_reference := reference
489
- child.prepare(child_reference,viewport_size)
554
+ child.prepare(reference,viewport_size,budget)
490
555
  child.measure()
491
556
  if not _reported_full_percent and children.size()>1:
492
557
  var main_name: String = ["width","height","depth"][axis]
@@ -494,7 +559,7 @@ func arrange(available: Vector3, external_axes: Vector3 = Vector3.ZERO) -> void:
494
559
  var spec: Dictionary = child.length_specs.get(main_name,{})
495
560
  if spec.get("unit","")=="%" and spec.get("value",0)>=100:
496
561
  _reported_full_percent = true
497
- push_warning("Estragon "+main_name+"=100% consumes the full definite parent content axis, not remaining space; siblings may overflow. Use an auto-sized Spacer with grow=1 for remaining space")
562
+ push_warning("Estragon "+main_name+"=100% consumes the full definite parent "+("dimension budget" if dimension_budget_enabled and strategy!="wrap" and axis<2 else "content axis")+", not remaining space; siblings may overflow. Use an auto-sized Spacer with grow=1 for remaining space")
498
563
  break
499
564
  var layout_content := content
500
565
  for index in range(2):
@@ -506,7 +571,7 @@ func arrange(available: Vector3, external_axes: Vector3 = Vector3.ZERO) -> void:
506
571
  var wrap_basis := _wrap_basis()
507
572
  slots = WrapPolicy.layout(items,layout_content,axis,physical_gaps,policy,align_content,Vector2(1 if reference.x>=0 or axis==0 and wrap_basis.x>=0 else 0,1 if reference.y>=0 or axis==1 and wrap_basis.y>=0 else 0)).slots
508
573
  else:
509
- slots = StackPolicy.slots(items,layout_content,axis,physical_gaps[axis] if axis<2 and length_specs.has("column_gap") else gap,policy)
574
+ slots = StackPolicy.slots(items,layout_content,axis,_main_gap(),policy)
510
575
  if strategy=="grid":
511
576
  policy_result = _grid(items,reference)
512
577
  if policy_result.has("error"): return
@@ -523,7 +588,8 @@ func arrange(available: Vector3, external_axes: Vector3 = Vector3.ZERO) -> void:
523
588
  if strategy=="grid" and cross<2 and policy[cross]=="stretch" and child.requested[cross]<0 and independent_axis(cross): authority[cross] = 1
524
589
  elif strategy!="grid" and cross!=axis and StackPolicy.cross_alignment(items[index],policy[cross],cross)=="stretch" and child.requested[cross]<0 and independent_axis(cross): authority[cross] = 1
525
590
  for scrolling_axis in range(2):
526
- if scroll_axes[scrolling_axis]>0: authority[scrolling_axis] = 0
591
+ if scroll_axes[scrolling_axis]>0:
592
+ authority[scrolling_axis] = 1 if independent_axis(scrolling_axis) and child.requested[scrolling_axis]<0 and (child.grow>0 or child.fill[scrolling_axis]>0) else 0
527
593
  child.arrange(slot.extent,authority)
528
594
  arranged.emit(size)
529
595
 
@@ -12,10 +12,12 @@ const MINIMUMS := ["min_width","min_height"]
12
12
  const DIMENSIONS := ["width","height","depth"]
13
13
  const BORDER_EDGES := ["border_top_width","border_right_width","border_bottom_width","border_left_width"]
14
14
  const OFFSETS := ["x","y","z"]
15
+ const SCROLLBAR_SIZES := ["scrollbar_size","vertical_scrollbar_width","horizontal_scrollbar_height"]
15
16
  const EDGES := ["padding","padding_top","padding_right","padding_bottom","padding_left","margin","margin_top","margin_right","margin_bottom","margin_left"]
16
17
  var specs: Dictionary = {}
17
18
  var parse_count := 0
18
19
  static func domain(name: String, script = null) -> String:
20
+ if name in SCROLLBAR_SIZES: return "inset" if name=="scrollbar_size" else "edge"
19
21
  if name in VisualStyle.RADII: return "inset" if name=="corner_radius" else "edge"
20
22
  if name in ["row_gap","column_gap"]: return "edge"
21
23
  if name=="padding" and VisualStyle.marked(script,"ESTRAGON_BUTTON_STYLE"): return "edge"
@@ -28,6 +30,7 @@ static func domain(name: String, script = null) -> String:
28
30
  return "inset" if name=="gap" else ""
29
31
  static func registered(type, name: String) -> bool:
30
32
  if domain(name).is_empty() or not type is Script: return false
33
+ if name in SCROLLBAR_SIZES: return VisualStyle.marked(type,"ESTRAGON_SCROLL_2D")
31
34
  if name in VisualStyle.RADII: return VisualStyle.supported(type)
32
35
  if (name in MINIMUMS or name in MAXIMUMS) and not VisualStyle.marked(type,"ESTRAGON_MINIMUMS_2D"): return false
33
36
  if name in ["row_gap","column_gap"] and not VisualStyle.marked(type,"ESTRAGON_GAPS_2D"): return false
@@ -87,6 +90,7 @@ static func dependencies(specs: Dictionary, stack_axis: int) -> Array:
87
90
  for name in specs:
88
91
  var unit: String = specs[name].unit
89
92
  if unit=="%":
93
+ if name in SCROLLBAR_SIZES: continue # Own pre-gutter content, not parent.
90
94
  if name in ["width","min_width","max_width","x","column_gap","margin_left","margin_right","padding_left","padding_right","border_left_width","border_right_width"]: parent_axes.x = 1
91
95
  elif name in ["height","min_height","max_height","y","row_gap","margin_top","margin_bottom","padding_top","padding_bottom","border_top_width","border_bottom_width"]: parent_axes.y = 1
92
96
  elif name in ["depth","z"]: parent_axes.z = 1
@@ -4,6 +4,8 @@ extends RefCounted
4
4
  const Hosts = preload("composition_hosts.tres")
5
5
  const Pointer = preload("pointer_2d.gd")
6
6
  const Focus = preload("focus.tres")
7
+ const ScrollbarSkin = preload("scrollbar_style.gd")
8
+ const Geometry = preload("scrollbar_geometry.gd")
7
9
  var owner_ref: WeakRef
8
10
  var host:
9
11
  get: return owner_ref.get_ref()
@@ -11,6 +13,11 @@ var _clip: Control
11
13
  var _content: Node2D
12
14
  var _horizontal: HScrollBar
13
15
  var _vertical: VScrollBar
16
+ var _corner: ColorRect
17
+ var _geometry: Dictionary = {}
18
+ var _skin_context: Array = []
19
+ var style_updates := 0
20
+ var _fit_pending := false
14
21
  var _updating := false
15
22
  var _input_guard = preload("scroll_input.gd").new()
16
23
  func _init(owner: Node2D) -> void:
@@ -42,6 +49,9 @@ func _ensure_viewport() -> void:
42
49
  _content.child_exiting_tree.connect(_children_changed)
43
50
  _horizontal = HScrollBar.new()
44
51
  _vertical = VScrollBar.new()
52
+ _corner = ColorRect.new()
53
+ _corner.mouse_filter = Control.MOUSE_FILTER_IGNORE
54
+ host.add_child(_corner,false,Node.INTERNAL_MODE_BACK)
45
55
  host.add_child(_horizontal,false,Node.INTERNAL_MODE_BACK)
46
56
  # BACK appends internal children after the clip/content branch. FRONT is
47
57
  # the beginning of SceneTree order and would let native Controls win GUI
@@ -53,8 +63,14 @@ func _ensure_viewport() -> void:
53
63
  _vertical.custom_step = 40
54
64
  _horizontal.value_changed.connect(_horizontal_changed)
55
65
  _vertical.value_changed.connect(_vertical_changed)
66
+ # Arrowless native bars: the thumb/track still own all native interaction.
67
+ var blank := ImageTexture.create_from_image(Image.create(1,1,false,Image.FORMAT_RGBA8))
68
+ for bar in [_horizontal,_vertical]:
69
+ bar.clip_contents = true # Explicit StyleBox expansion cannot paint over V.
70
+ bar.minimum_size_changed.connect(_minimum_changed)
71
+ for icon in ["increment","increment_highlight","increment_pressed","decrement","decrement_highlight","decrement_pressed"]: bar.add_theme_icon_override(icon,blank)
56
72
  func is_private(child: Node) -> bool:
57
- return child==_clip or child==_horizontal or child==_vertical
73
+ return child==_clip or child==_horizontal or child==_vertical or child==_corner
58
74
  func _children_changed(_child: Node) -> void:
59
75
  if host!=null: host._layout_children_changed.emit()
60
76
  func _remember_owners(node: Node, values: Dictionary) -> void:
@@ -78,6 +94,12 @@ func _adopt_content(child: Node) -> void:
78
94
  if owners[node].is_ancestor_of(node): node.owner = owners[node]
79
95
  if is_instance_valid(focus) and focus.is_inside_tree(): focus.grab_focus()
80
96
  host.layout._sync()
97
+ # Native reparent notifications can precede the new ancestor's coordinator
98
+ # activation. Refresh keyboard/pointer scope after that tree transition.
99
+ _refresh_scope.call_deferred(weakref(child))
100
+ func _refresh_scope(reference: WeakRef) -> void:
101
+ var child = reference.get_ref()
102
+ if host!=null and host.is_inside_tree() and child!=null and child.is_inside_tree() and _content.is_ancestor_of(child): Hosts._refresh_scope(child)
81
103
  func start() -> void:
82
104
  if not clipping() and not is_instance_valid(_clip) and host.get_node_or_null("_EstragonViewport")==null: return
83
105
  _ensure_viewport()
@@ -116,12 +138,59 @@ func offset_changed() -> void:
116
138
  if not host.layout.model.is_layout_dirty(): _update_scroll()
117
139
  func _refresh_viewport() -> void:
118
140
  if not is_instance_valid(_clip): return
119
- var rect: Rect2 = host.get_content_rect()
141
+ _geometry = host.layout.model.scroll_geometry
142
+ if _geometry.is_empty(): _geometry = Geometry.snapshot(host.get_content_rect(),Vector2(1 if host.horizontal_scroll else 0,1 if host.vertical_scroll else 0),host.lengths.specs,host.layout.model.viewport_size)
143
+ var rect: Rect2 = _geometry.viewport
120
144
  _clip.position = rect.position
121
145
  _clip.size = rect.size
122
146
  host._content_extent = host.layout.model.content_extent()
123
147
  host._scroll_range = Vector2(maxf(0,host.content_extent.x-rect.size.x) if host.horizontal_scroll else 0,maxf(0,host.content_extent.y-rect.size.y) if host.vertical_scroll else 0)
124
148
  _update_scroll()
149
+ func refresh_style() -> void:
150
+ if not is_instance_valid(_horizontal) or _geometry.is_empty(): return
151
+ var context := [host.scrollbar_style,_geometry.vertical.size,_geometry.horizontal.size,host.layout.model.viewport_size]
152
+ if context==_skin_context: return
153
+ _skin_context = context.duplicate(true)
154
+ style_updates += 1
155
+ for axis in ["horizontal","vertical"]:
156
+ var bar: ScrollBar = _horizontal if axis=="horizontal" else _vertical
157
+ var rect: Rect2 = _geometry[axis]
158
+ var style := ScrollbarSkin.values(host.scrollbar_style,axis)
159
+ bar.add_theme_stylebox_override("scroll",ScrollbarSkin.box(style,"track","",rect.size,host.layout.model.viewport_size))
160
+ for pair in [["grabber",""],["grabber_highlight","_hover"],["grabber_pressed","_pressed"]]:
161
+ bar.add_theme_stylebox_override(pair[0],ScrollbarSkin.box(style,"thumb",pair[1],rect.size,host.layout.model.viewport_size))
162
+ var focus := StyleBoxFlat.new()
163
+ focus.bg_color = Color.TRANSPARENT
164
+ focus.border_color = Color("#eeeeee")
165
+ focus.set_border_width_all(1)
166
+ bar.add_theme_stylebox_override("scroll_focus",focus)
167
+ _corner.color = ScrollbarSkin.color(ScrollbarSkin.values(host.scrollbar_style,"vertical"),"corner_color")
168
+ _fit_tracks()
169
+ func _minimum_changed() -> void:
170
+ if _fit_pending: return
171
+ _fit_pending = true
172
+ _fit_tracks.call_deferred()
173
+ func _fit_tracks() -> void:
174
+ _fit_pending = false
175
+ if host==null or not is_instance_valid(_horizontal) or _geometry.is_empty(): return
176
+ _place_bar(_horizontal,_geometry.horizontal)
177
+ _place_bar(_vertical,_geometry.vertical)
178
+ func _place_bar(bar: ScrollBar, rect: Rect2) -> void:
179
+ # There is no native hit surface for an empty strip. In particular, 4.0
180
+ # coerces zero Control scales to epsilon; never feed that degenerate transform
181
+ # into native minimum-size adjustment.
182
+ if rect.size.x<=0 or rect.size.y<=0:
183
+ bar.hide()
184
+ return
185
+ if bar.position!=rect.position: bar.position = rect.position
186
+ # Custom StyleBox minimums must never enlarge the parent-owned strip.
187
+ # Native Control hit testing follows this same transform, including drag.
188
+ var floor := bar.get_combined_minimum_size()
189
+ var logical := Vector2(maxf(rect.size.x,floor.x),maxf(rect.size.y,floor.y))
190
+ if bar.size!=logical: bar.size = logical
191
+ var native_size := Vector2(maxf(1,bar.size.x),maxf(1,bar.size.y))
192
+ var physical_scale := rect.size/native_size
193
+ if bar.scale!=physical_scale: bar.scale = physical_scale
125
194
  func _update_scroll() -> void:
126
195
  if _updating or not is_instance_valid(_content): return
127
196
  _updating = true
@@ -131,17 +200,22 @@ func _update_scroll() -> void:
131
200
  var entry = host.get_layout_root()
132
201
  if entry!=null and entry.has_method("_get_pointer_router"): entry._get_pointer_router().cancel()
133
202
  _content.position = -host.get_content_rect().position-host.scroll_offset
134
- var rect: Rect2 = host.get_content_rect()
135
- _horizontal.visible = host.scroll_range.x>0
136
- _vertical.visible = host.scroll_range.y>0
137
- _horizontal.position = rect.position+Vector2(0,maxf(0,rect.size.y-12))
138
- _horizontal.size = Vector2(maxf(0,rect.size.x-(12 if _vertical.visible else 0)),12)
139
- _vertical.position = rect.position+Vector2(maxf(0,rect.size.x-12),0)
140
- _vertical.size = Vector2(12,maxf(0,rect.size.y-(12 if _horizontal.visible else 0)))
141
- _horizontal.max_value = host.content_extent.x
203
+ if _geometry.is_empty():
204
+ _updating = false
205
+ return
206
+ var rect: Rect2 = _geometry.viewport
207
+ refresh_style()
208
+ _horizontal.visible = host.scroll_range.x>0 and _geometry.horizontal.size.x>0 and _geometry.horizontal.size.y>0
209
+ _vertical.visible = host.scroll_range.y>0 and _geometry.vertical.size.x>0 and _geometry.vertical.size.y>0
210
+ _place_bar(_horizontal,_geometry.horizontal)
211
+ _place_bar(_vertical,_geometry.vertical)
212
+ _corner.position = _geometry.corner.position
213
+ _corner.size = _geometry.corner.size
214
+ _corner.visible = _corner.size.x>0 and _corner.size.y>0
215
+ _horizontal.max_value = maxf(host.content_extent.x,rect.size.x)
142
216
  _horizontal.page = rect.size.x
143
217
  _horizontal.value = host.scroll_offset.x
144
- _vertical.max_value = host.content_extent.y
218
+ _vertical.max_value = maxf(host.content_extent.y,rect.size.y)
145
219
  _vertical.page = rect.size.y
146
220
  _vertical.value = host.scroll_offset.y
147
221
  _updating = false
@@ -152,11 +226,8 @@ func _vertical_changed(value: float) -> void:
152
226
  if not _updating: host.scroll_offset = Vector2(host.scroll_offset.x,value)
153
227
  func pointer_allowed(position: Vector2) -> bool:
154
228
  if not enabled(): return true
155
- for bar in [_horizontal,_vertical]:
156
- if is_instance_valid(bar) and bar.is_visible_in_tree():
157
- var point: Vector2 = bar.get_global_transform_with_canvas().affine_inverse()*position
158
- if Rect2(Vector2.ZERO,bar.size).has_point(point): return false
159
- return true
229
+ var point: Vector2 = host.get_global_transform_with_canvas().affine_inverse()*position
230
+ return _geometry.is_empty() or _geometry.viewport.has_point(point)
160
231
  func input(event: InputEvent) -> void:
161
232
  if not enabled() or Engine.is_editor_hint() or not host.is_visible_in_tree() or not (event is InputEventMouse or event is InputEventPanGesture): return
162
233
  var point: Vector2 = host.get_global_transform_with_canvas().affine_inverse()*event.position
@@ -0,0 +1,20 @@
1
+ @tool
2
+ extends RefCounted
3
+ ## One noncircular snapshot: own pre-gutter P -> V, tracks and corner.
4
+ const Length=preload("length.gd")
5
+ static func thickness(inner: Vector2,axes: Vector2,specs: Dictionary,viewport: Vector2) -> Vector2:
6
+ var shared: Dictionary=specs.get("scrollbar_size",{"unit":"native","value":12.0})
7
+ var vertical: Dictionary=specs.get("vertical_scrollbar_width",shared)
8
+ var horizontal: Dictionary=specs.get("horizontal_scrollbar_height",shared)
9
+ if vertical.unit=="auto": vertical=shared
10
+ if horizontal.unit=="auto": horizontal=shared
11
+ var result=Vector2.ZERO
12
+ if axes.y>0: result.x=maxf(0,Length.resolve(vertical,inner.x,viewport))
13
+ if axes.x>0: result.y=maxf(0,Length.resolve(horizontal,inner.y,viewport))
14
+ if inner.x>=0: result.x=minf(inner.x,result.x)
15
+ if inner.y>=0: result.y=minf(inner.y,result.y)
16
+ return result
17
+ static func snapshot(inner: Rect2,axes: Vector2,specs: Dictionary,viewport: Vector2) -> Dictionary:
18
+ var strips=thickness(inner.size,axes,specs,viewport)
19
+ var size=Vector2(maxf(0,inner.size.x-strips.x),maxf(0,inner.size.y-strips.y))
20
+ return {"inner":inner,"viewport":Rect2(inner.position,size),"thickness":strips,"vertical":Rect2(inner.position+Vector2(size.x,0),Vector2(strips.x,size.y)),"horizontal":Rect2(inner.position+Vector2(0,size.y),Vector2(size.x,strips.y)),"corner":Rect2(inner.position+size,strips)}
@@ -0,0 +1 @@
1
+ uid://cxvto2nj2s2xj
@@ -0,0 +1,47 @@
1
+ @tool
2
+ extends RefCounted
3
+ ## Local native scrollbar skin contract. No themes, Nodes or layout policy.
4
+ const Length=preload("length.gd")
5
+ const Visual=preload("visual_style_2d.gd")
6
+ const COLORS=["track_color","thumb_color","thumb_hover_color","thumb_pressed_color","corner_color","track_border_color","thumb_border_color"]
7
+ const LENGTHS=["track_corner_radius","thumb_corner_radius","track_border_width","thumb_border_width"]
8
+ const BOXES=["track_stylebox","thumb_stylebox","thumb_hover_stylebox","thumb_pressed_stylebox"]
9
+ const DEFAULTS={"track_color":"#292929","thumb_color":"#727272","thumb_hover_color":"#919191","thumb_pressed_color":"#aaaaaa","corner_color":"#383838","track_border_color":"transparent","thumb_border_color":"transparent","track_corner_radius":0,"thumb_corner_radius":0,"track_border_width":0,"thumb_border_width":0}
10
+ static func error(value, nested: bool=false) -> String:
11
+ if not value is Dictionary: return "scrollbar_style requires Dictionary"
12
+ for key in value:
13
+ if not key is String: return "scrollbar_style keys require String"
14
+ var item=value[key]
15
+ if key in ["vertical","horizontal"] and not nested:
16
+ var problem=error(item,true)
17
+ if not problem.is_empty(): return key+": "+problem
18
+ elif key in COLORS:
19
+ if Visual.parse_color(item).has("error"): return key+" requires a finite Color, hex or transparent"
20
+ elif key in LENGTHS:
21
+ if Length.parse(item,"inset").has("error"): return key+" requires a finite nonnegative Length"
22
+ elif key in BOXES:
23
+ if not item is StyleBox: return key+" requires StyleBox Resource"
24
+ else: return "unknown scrollbar_style key "+key
25
+ return ""
26
+ static func values(style: Dictionary, axis: String) -> Dictionary:
27
+ var result=DEFAULTS.duplicate()
28
+ for key in style:
29
+ if key not in ["vertical","horizontal"]: result[key]=style[key]
30
+ result.merge(style.get(axis,{}),true)
31
+ return result
32
+ static func color(style: Dictionary,key: String) -> Color: return Visual.parse_color(style[key]).color
33
+ static func box(style: Dictionary,part: String,state: String,rect: Vector2,viewport: Vector2) -> StyleBox:
34
+ var key=part+state+"_stylebox"
35
+ if style.has(key): return style[key]
36
+ var result=StyleBoxFlat.new()
37
+ var tint=part+state+"_color"
38
+ result.bg_color=color(style,tint)
39
+ result.border_color=color(style,part+"_border_color")
40
+ var reference=minf(rect.x,rect.y)
41
+ var border=mini(ceili(reference*0.5),ceili(Length.resolve(Length.parse(style[part+"_border_width"],"inset"),reference,viewport)))
42
+ var radius=mini(ceili(reference*0.5),ceili(Length.resolve(Length.parse(style[part+"_corner_radius"],"inset"),reference,viewport)))
43
+ for edge in [SIDE_LEFT,SIDE_TOP,SIDE_RIGHT,SIDE_BOTTOM]:
44
+ result.set_border_width(edge,border)
45
+ result.set_content_margin(edge,0)
46
+ for corner in range(4): result.set_corner_radius(corner,radius)
47
+ return result
@@ -0,0 +1 @@
1
+ uid://ccucmnac0fbnh
package/package.json CHANGED
@@ -29,5 +29,5 @@
29
29
  "tag": "beta",
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
- "version": "0.1.0-beta.32"
32
+ "version": "0.1.0-beta.34"
33
33
  }