I’m working with a CustomMenu
where I override the drawTitle()
function to set a custom background color and draw a Text
drawable. Since the background shouldn’t cover the entire title area, I apply a clip region before calling Dc.clear()
, and then reset the clipping using Dc.clearClip()
.
However, applying the clip causes an unexpected side effect: when switching to a different view that is not a CustomMenu
- either via WatchUi.pushView()
or WatchUi.switchToView()
- the Dc
in the new view appears to be clipped. But the clipping is not to my custom region; instead, it matches the full bounds of the title Dc
from the previous menu.
Oddly, calling Dc.clearClip()
inside CustomMenu.drawTitle()
has no effect.
What does work is calling Dc.clearClip()
in the new view’s onUpdate()
or onLayout()
method. Another workaround is to avoid setting a clip region altogether. Instead, you can either fill the entire title Dc
, or use Dc.fillRectangle()
to draw only the desired area manually - neither approach leads to this issue.
To illustrate the issue, I set the background color of the new view to blue. In the first screenshot, you can see my intended clipped area rendered in grey. In the second screenshot—after switching views - you’ll notice that only the title region is filled with blue, while the rest of the screen remains untouched, as if still clipped.
This is not a simulator issue - I’ve confirmed the same behavior occurs on a real device (Epix 2 Pro 47mm).
You can find the project here:
https://github.com/TheNinth7/ohg/issues
The relevant CustomMenu
implementation is located at:
https://github.com/TheNinth7/ohg/blob/main/source/ui/commons/BaseMenu.mc