View is not properly centered at startup

Bug #1831005 reported by Jon Evans
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Unknown

Bug Description

On recent master builds, the view is not centered properly when starting up on a blank board because COMMON_TOOLS::ZoomFitScreen is calculating an incorrect worldScrollbarSize at startup. Using the zoom to fit action after the window is created results in a proper centering.

This is with GTK3 in case it's relevant.

Application: Pcbnew
Version: (5.1.0-781-g9094a1779), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-48-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.4.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Jon Evans (craftyjon)
Changed in kicad:
importance: Undecided → Low
milestone: none → 6.0.0-rc1
description: updated
tags: added: pcbnew
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Jon, was commit 9094a177 to fix this? It appears that Pcbnew centers on the worksheet when the board is empty.

Revision history for this message
Jon Evans (craftyjon) wrote :

No, 9094a177 was for the discussion we had about centering on worksheet or not. I still see this bug.

Revision history for this message
Jon Evans (craftyjon) wrote :

Ok, now for some reason after the recent (massive) changes, this behavior has changed.
Now, Eeschema at startup does not properly redraw the screen after executing the zoom-to-fit, so I see the wrong view (zoomed in on the worksheet border) until I move my mouse over the canvas, which triggers a redraw to the correct view.

Application: Eeschema
Version: (5.1.0-829-g63fb40847-dirty), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-48-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.4.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Jon Evans (craftyjon) wrote :
Revision history for this message
Jon Evans (craftyjon) wrote :
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Jon, I'm not sure I fully understand what your problem is looking at your screen captures. Is the problem that the worksheet is not properly centered with an empty board on start up or that the initial cursor is placed at the upper left (0,0) position of the sheet? I'm only seeing the latter (see attached image).

Application: Pcbnew
Version: (5.1.0-843-gcb83f8acd), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 GnuTLS/3.6.4 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.1 librtmp/2.3
Platform: Linux 4.18.0-20-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.3.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Changed in kicad:
status: New → Incomplete
Revision history for this message
Jon Evans (craftyjon) wrote :

Wayne, this issue only impacts Eeschema for me, not PcbNew.
In the image "before_moving_mouse.png", this is what I see when first opening Eeschema. It is supposed to display the empty worksheet, but instead the display is zoomed in on the top left corner.
If I then move my mouse over the canvas, it triggers a repaint and now the display is correct (second image)

Changed in kicad:
status: Incomplete → New
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Jon, I'm not seeing this issue on Eeschema with an empty schematic either. Maybe it has something to do with the fact that your wxWidgets build is against gtk 3.22 and my build is against gtk 3.24. Any way you could test this or maybe someone else can reproduce this.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I am seeing that on W7 / 32bits

tags: added: eeschema
Revision history for this message
Jon Evans (craftyjon) wrote :

Now with Jeff's commit 1bf04d1 the behavior has changed yet again :)
This time the initial screen is zoomed way in, and does not change on mouse-over.

I think because Jeff changed the lines to:
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );

By including the "true" (run now), the command is run before the window is set up and so the calculated window size is wrong. So it seems like we have to run this deferred (so it will happen after the window is created) but somehow a repaint is not happening on Eeschema that does happen on PcbNew (on my environment, at least)

Revision history for this message
Jon Evans (craftyjon) wrote :
Revision history for this message
Jeff Young (jeyjey) wrote :

There's definitely some event timing issue going on. (Both strategies work fine on OSX.)

I was hoping the immediate mode would improve things, but it sounds like it made it worse.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

After watching Jon's latest video, I can reproduce this but only when running Eeschema in the stand along mode. This behavior is not present when launching Eeschema from KiCad.

Changed in kicad:
status: New → Triaged
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/1903

Changed in kicad:
status: Triaged → Expired
Changed in kicad:
importance: Low → Unknown
status: Expired → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.