scatter3d-anywidget 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
scatter3d/scatter3d.py CHANGED
@@ -489,6 +489,12 @@ class Scatter3dWidget(anywidget.AnyWidget):
489
489
  help="Legend dock: 'top' or 'bottom'.",
490
490
  ).tag(sync=True)
491
491
 
492
+ # Widget height in CSS pixels (desired height).
493
+ widget_height_px_t = traitlets.Float(
494
+ default_value=600.0,
495
+ help="Desired widget height in CSS pixels. Frontend will clamp to notebook constraints.",
496
+ ).tag(sync=True)
497
+
492
498
  def __init__(
493
499
  self,
494
500
  xyz: numpy.ndarray,
@@ -532,6 +538,24 @@ class Scatter3dWidget(anywidget.AnyWidget):
532
538
  # Enforce initial invariants (rotate default allows empty active category)
533
539
  self._ensure_active_category_invariants()
534
540
 
541
+ @traitlets.validate("widget_height_px_t")
542
+ def _validate_widget_height_px_t(self, proposal):
543
+ v = float(proposal["value"])
544
+ if not numpy.isfinite(v) or v <= 0:
545
+ raise traitlets.TraitError("widget_height_px_t must be a finite number > 0")
546
+ return v
547
+
548
+ def _get_height(self) -> float:
549
+ return float(self.widget_height_px_t)
550
+
551
+ def _set_height(self, value: float) -> None:
552
+ v = float(value)
553
+ if not numpy.isfinite(v) or v <= 0:
554
+ raise ValueError("height must be a finite number > 0")
555
+ self.widget_height_px_t = v
556
+
557
+ height = property(_get_height, _set_height)
558
+
535
559
  @traitlets.validate("interaction_mode_t")
536
560
  def _validate_interaction_mode_t(self, proposal):
537
561
  v = proposal["value"]