Update 'selected' choice styling when loading an older save
Showing 4 of 11 files from the diff.
Other files ignored by Codecov
api/src/main/java/nl/weeaboo/vn/scene/IButton.java
has changed.
template/res/script/main.lvn
has changed.
core/src/main/lua/builtin/script/vn/choice.lua
has changed.
@@ -90,6 +90,15 @@
Loading
90 | 90 | renderer.update(); |
|
91 | 91 | } |
|
92 | 92 | ||
93 | + | @Override |
|
94 | + | public void click() { |
|
95 | + | model.click(); |
|
96 | + | ||
97 | + | if (clickHandler != null && model.consumePress()) { |
|
98 | + | eventDispatcher.addEvent(clickHandler); |
|
99 | + | } |
|
100 | + | } |
|
101 | + | ||
93 | 102 | @Override |
|
94 | 103 | public void handleInput(Matrix parentTransform, IInput input) { |
|
95 | 104 | super.handleInput(parentTransform, input); |
@@ -1,9 +1,12 @@
Loading
1 | 1 | package nl.weeaboo.vn.impl.scene; |
|
2 | 2 | ||
3 | + | import javax.annotation.CheckForNull; |
|
3 | 4 | import javax.annotation.Nullable; |
|
4 | 5 | ||
6 | + | import com.google.common.base.Predicate; |
|
5 | 7 | import com.google.common.collect.ImmutableCollection; |
|
6 | 8 | import com.google.common.collect.ImmutableSet; |
|
9 | + | import com.google.common.collect.Iterables; |
|
7 | 10 | ||
8 | 11 | import nl.weeaboo.vn.scene.ILayer; |
|
9 | 12 | import nl.weeaboo.vn.scene.IVisualElement; |
@@ -48,6 +51,23 @@
Loading
48 | 51 | } |
|
49 | 52 | } |
|
50 | 53 | ||
54 | + | @CheckForNull |
|
55 | + | public static <T> T findFirst(IVisualElement elem, Class<T> resultType, Predicate<? super T> filter) { |
|
56 | + | ImmutableSet<IVisualElement> results = findRecursive(elem, input -> resultType.isInstance(input) && filter.apply(resultType.cast(input))); |
|
57 | + | return resultType.cast(Iterables.getFirst(results, null)); |
|
58 | + | } |
|
59 | + | ||
60 | + | public static ImmutableSet<IVisualElement> findRecursive(IVisualElement elem, Predicate<? super IVisualElement> filter) { |
|
61 | + | ImmutableSet.Builder<IVisualElement> result = ImmutableSet.builder(); |
|
62 | + | if (filter.apply(elem)) { |
|
63 | + | result.add(elem); |
|
64 | + | } |
|
65 | + | for (IVisualElement child : getChildren(elem, VisualOrdering.FRONT_TO_BACK)) { |
|
66 | + | result.addAll(findRecursive(child, filter)); |
|
67 | + | } |
|
68 | + | return result.build(); |
|
69 | + | } |
|
70 | + | ||
51 | 71 | /** |
|
52 | 72 | * @return An immutable sorted snapshot of the direct descendants of the given element. |
|
53 | 73 | */ |
@@ -21,7 +21,8 @@
Loading
21 | 21 | private boolean mouseArmed; |
|
22 | 22 | private int pressEvents; |
|
23 | 23 | ||
24 | - | protected void onClicked() { |
|
24 | + | @Override |
|
25 | + | public void click() { |
|
25 | 26 | LOG.trace("Button clicked: {}", this); |
|
26 | 27 | ||
27 | 28 | if (isToggle()) { |
@@ -106,7 +107,7 @@
Loading
106 | 107 | mouseArmed = p; |
|
107 | 108 | ||
108 | 109 | if (enabled && wasPressed && !isPressed()) { |
|
109 | - | onClicked(); |
|
110 | + | click(); |
|
110 | 111 | } |
|
111 | 112 | } |
|
112 | 113 | } |
Files | Complexity | Coverage |
---|---|---|
api/src/main/java/nl/weeaboo/vn | 91.53% | 96.76% |
buildtools/src/main/java/nl/weeaboo/vn/buildtools | 83.33% | 89.43% |
core/src/main/java/nl/weeaboo/vn | 82.55% | 86.78% |
desktop/src/main/java/nl/weeaboo/vn/desktop | 1.52% | 2.26% |
Project Totals (382 files) | 81.14% | 84.47% |
745981295
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.