-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from HotariTobu:feat/HotariTobu-radio-button-e…
…xample Add Radio Button Example
- Loading branch information
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
addons/gd_data_binding/scripts/converters/case_binding_converter.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class_name CaseBindingConverter | ||
extends BindingConverter | ||
|
||
var _case_value: Variant | ||
var _last_source_value: Variant | ||
|
||
|
||
func _init(case_value: Variant): | ||
_case_value = case_value | ||
|
||
|
||
func source_to_target(source_value: Variant) -> Variant: | ||
_last_source_value = source_value | ||
return source_value == _case_value | ||
|
||
|
||
func target_to_source(target_value: Variant) -> Variant: | ||
return _case_value if target_value else _last_source_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters