Bug 449621

Summary: fit to screen after loading file
Product: [Applications] umbrello Reporter: Jessica <jess.jones.unitedkingdom>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: okellogg
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: fit to screen

Description Jessica 2022-02-04 21:42:49 UTC
Created attachment 146277 [details]
fit to screen

When loading an existing file, the diagram is not displayed fit to screen. It's displayed very tiny in the middle of the screen (unreadable) but this view has no real use. When an existing file is loaded, it should be fitted to the screen immediately after loading (same as option "fit").

Example file attached

OBSERVED RESULT
An existing file is not fitted to the screen when loading. 

EXPECTED RESULT
When an existing file is loaded, it should be fitted to the screen immediately after loading.
The user can choose  "fit (100%)"  later, when the screen was zoomed in/out by the user.


SOFTWARE/OS VERSIONS
Windows 10
git 37b9e8e
Comment 1 Oliver Kellogg 2022-02-04 21:55:30 UTC

*** This bug has been marked as a duplicate of bug 449622 ***
Comment 2 Oliver Kellogg 2022-02-05 22:53:15 UTC
It looks as though version 2.32 may produce some weird diagram coordinate values.
First line in <diagram>:

<diagram showopsig="1" [...] canvasheight="4.29497e+09" canvaswidth="4.29487e+09" 

The canvasheight and canvaswidth values are unusable.
By fortunate chance, the diagram loadFromXMI function happens to ignores these attributes.

However, there are also huge offsets on the x/y coordinates in the diagram  elements.
First <classwidget> in <diagram>:
<classwidget linecolor="#ff0000" [...] x="-95708.9" showattsigs="601" showstereotype="1" y="-36843.3" 

Looking at the x / y values of the further widgets, they all have a huge offset factor.

For the load code this would mean there would need to be an extra first pass which determines the minimum of all x and the minimum of all y values, and in the actual loading pass the minX / minY would need to be subtracted from the x / y values.
I'm not sure if and when I get around to implementing that - but there is a fairly simple workaround:
Select the arrow tool and draw a rectangle around the objects (group selection). Then move the group to the top left corner of the diagram.