Skip to content

Commit

Permalink
Add highlight_color (#666)
Browse files Browse the repository at this point in the history
Closes #661
  • Loading branch information
kylebarron authored Oct 3, 2024
1 parent 111f88f commit 667dfed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lonboard/_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ def _add_extension_traits(self, extensions: Sequence[BaseExtension]):
- Default: `False`
"""

highlight_color = VariableLengthTuple(
t.Int(), default_value=None, minlen=3, maxlen=4
)
"""
RGBA color to blend with the highlighted object (the hovered over object if
`auto_highlight=true`). When the value is a 3 component (RGB) array, a default alpha
of 255 is applied.
- Type: List or Tuple of integers
- Default: `[0, 0, 128, 128]`
"""

selected_bounds = t.Tuple(
t.Float(), t.Float(), t.Float(), t.Float(), allow_none=True, default_value=None
).tag(sync=True)
Expand Down
5 changes: 5 additions & 0 deletions src/model/base-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export abstract class BaseLayerModel extends BaseModel {
protected visible: LayerProps["visible"];
protected opacity: LayerProps["opacity"];
protected autoHighlight: LayerProps["autoHighlight"];
protected highlightColor: LayerProps["highlightColor"];

protected extensions: BaseExtensionModel[];

Expand All @@ -32,6 +33,7 @@ export abstract class BaseLayerModel extends BaseModel {
this.initRegularAttribute("visible", "visible");
this.initRegularAttribute("opacity", "opacity");
this.initRegularAttribute("auto_highlight", "autoHighlight");
this.initRegularAttribute("highlight_color", "highlightColor");
this.initRegularAttribute("selected_bounds", "selectedBounds");

this.extensions = [];
Expand Down Expand Up @@ -74,6 +76,9 @@ export abstract class BaseLayerModel extends BaseModel {
visible: this.visible,
opacity: this.opacity,
autoHighlight: this.autoHighlight,
...(isDefined(this.highlightColor) && {
highlightColor: this.highlightColor,
}),
onClick: this.onClick.bind(this),
};
}
Expand Down

0 comments on commit 667dfed

Please sign in to comment.