Hi,
I have raised a question on the Discussion forum regarding the area available for drawing a data field on the Instinct 2 family. The full thread is available here: https://forums.garmin.com/developer/connect-iq/f/discussion/401206/how-to-handle-the-instinct-2-screen/1885985#1885985
Basically, I ran a test in order to get the screen dimensions of the I2 base model and compared the results with the reference page. While the reference page says its dimensions are 176 x 176, the dc.getWidth and dc.getHeight return 112 x 71. Also, on the original thread, it was noted that the onLayout seems to be called twice when only one was expected.
As a consequence, the area available for drawing is reduced:
The same code on I3, for example, works as expected:
The code is the following:
screenWidth = dc.getWidth();
screenHeight = dc.getHeight();
screenLines = [
// Horizontal lines
[0, screenHeight/4, screenWidth, screenHeight/4],
[0, 2*(screenHeight/4), screenWidth, 2*(screenHeight/4)],
[0, 3*(screenHeight/4), screenWidth, 3*(screenHeight/4)],
// Vertical lines
[screenWidth/2, 2*(screenHeight/8), screenWidth/2, 6*(screenHeight/8)]
];
and eventually I use dc.drawLine to draw the lines.
So, is this some kind of bug on the simulator? Does this also happen on real devices?