Skip to content

Add brush behavior binary operators kAndThen, kOrElse, and kXorElse#516

Merged
copybara-service[bot] merged 1 commit intomainfrom
test_874638101
Feb 25, 2026
Merged

Add brush behavior binary operators kAndThen, kOrElse, and kXorElse#516
copybara-service[bot] merged 1 commit intomainfrom
test_874638101

Conversation

@copybara-service
Copy link

Add brush behavior binary operators kAndThen, kOrElse, and kXorElse

These three operators allow for greater control over how to handle null values (e.g. unavailable source data) in brush behaviors:

  • kOrElse returns the first non-null input, allowing for fallback branches in a brush behavior. If a subtree based on some source (like stylus tilt) is unavailable, the behavior can fall back to a substitute implementation.
  • kAndThen returns the second input, but only if the first input is non-null. This can help when two separate behaviors are meant to work together, but one relies on a source that might be unavailable; kAndThen can be used in the other behavior to ensure that it also gets disabled when that source is unavailable.
  • kXorElse is more niche, but can be used to combine two subtrees where only one should normally be defined at a time, and there's no defined way to combine them if both are defined. It can also be used with a constant node to form a sort of "logical not" for null values.

@copybara-service copybara-service bot force-pushed the test_874638101 branch 2 times, most recently from 6e377eb to fd97f36 Compare February 25, 2026 18:48
…lse`

These three operators allow for greater control over how to handle null values (e.g. unavailable source data) in brush behaviors:
* `kOrElse` returns the first non-null input, allowing for fallback branches in a brush behavior. If a subtree based on some source (like stylus tilt) is unavailable, the behavior can fall back to a substitute implementation.
* `kAndThen` returns the second input, but only if the first input is non-null. This can help when two separate behaviors are meant to work together, but one relies on a source that might be unavailable; `kAndThen` can be used in the other behavior to ensure that it also gets disabled when that source is unavailable.
* `kXorElse` is more niche, but can be used to combine two subtrees where only one should normally be defined at a time, and there's no defined way to combine them if both are defined.  It can also be used with a constant node to form a sort of "logical not" for null values.

PiperOrigin-RevId: 875239647
@copybara-service copybara-service bot merged commit 40bfce5 into main Feb 25, 2026
@copybara-service copybara-service bot deleted the test_874638101 branch February 25, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants