Fixing Bug: displaying a new screen, with transition effect, that has an initial focus on a Text doing slide animation causes the screen to not be rendered correctly:
Cause:
While the transition between the two screens is rendered the slideTextWorkerTask of the Text widget will shrink the repaint area of the canvas to the size of the Text widget, this happens as following:
slideTextWorkerTask -> invalidateAppearance() -> Widget. invalidateAppearanceRegion(0, 0, width, height) -> Desktop.invalidateAppearanceRegion(..) -> canvas. repaintNextFrame(x, y, width, height)
Solution:
Disable the function of slideTextWorkerTask while rendering transition between screens
In Text.java:
if (isVisible()&& !Kuix.getCanvas().isTransitionRunning()) {
if (textX < minOffset || textX > maxOffset) {
slideTextIncrement *= -1;
}
textX += slideTextIncrement;
invalidateAppearance();
}
In KuixCanvas.java add the following function:
public boolean isTransitionRunning(){
return transitionRunning;
}
Fixing Bug: Displaying an old (was displayed before) screen that has an initial focus on a TextWidget (that has slide animation) doesn’t trigger the slide animation of that TextWidget:
Cause:
While slideTextWorkerTask will be terminated when the container screen is not the current screen, this termination is cause by the following line of code in the task:
return !isInWidgetTree();
The task is not called again because the doLayout() is called only for the first time when creating the screen and adding widgets to it.
Solution:
When displaying a screen trigger all focused child Text widgets inside the screen, to start the slideTextWorkerTask.
In Desktop.java:
if (screen != null) {
super.add(screen);
//By Wamsoft: triger text slid animation should be called here
triggerSlideAnimation(this);
}
void triggerSlideAnimation(Widget widget) {
for (widget = widget.getChild(); widget != null; widget = widget.next) {
if (widget instanceof Text && widget.isFocusWidgetChild()){
((Text)widget).triggerSlideAnimation();
}
if (widget instanceof Ticker) // Ticker is a custom widget
((Ticker)widget).triggerSlideAnimation();
if (widget.getChild()!=null)
triggerSlideAnimation(widget);
}
}
In Text.java:
public void triggerSlideAnimation(){
if (slideTextWorkerTask != null) {
Worker.instance.removeTask(slideTextWorkerTask);
textX = originalTextX;
slideTextIncrement = 1;
Worker.instance.pushTask(slideTextWorkerTask);
}
}
ramezs@gmail.com

