https://bugs.kde.org/show_bug.cgi?id=449622
--- Comment #5 from Oliver Kellogg <okell...@users.sourceforge.net> --- Git commit d8fe02e4f1f963d67fdfc7072ca8cc9c4292b0d9 by Oliver Kellogg. Committed on 11/02/2022 at 12:50. Pushed by okellogg into branch 'master'. https://bugs.kde.org/show_bug.cgi?id=449622#c3 > 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, [...] umbrello/umlscene.h - Split static member defaultCanvasSize into the two static members s_defaultCanvasWidth and s_defaultCanvasHeight for finer control. - At static member m_showDocumentationIndicator change prefix from "m_" to "s_" for symmetry with other static members. - New members m_minX, m_minY, m_maxX, m_maxY gather data used for estimating required canvas size. They are filled during loadFromXMI(). - New members m_fixX and m_fixY are used for compensating for undue offsets of x/y values in previous version XMI files. Further, the QGraphicsScene coordinate system is changed to originate at x/y position (0,0). This means there are no longer negative values for x/y coordinates. - New function updateCanvasSizeEstimate is called during loadFromXMI() of the individual widgets. The members m_minX, m_minY, m_maxX, m_maxY may be updated by the arguments x, y, w, h. - New getters fixX() and fixY() return m_fixX and m_fixY, respectively. They are called from the loadFromXMI functions of individual widgets. umbrello/umlscene.cpp - In function loadFromXMI : - Parse attributes "canvaswidth" and "canvasheight" into qreals canvasWidth and canvasHeight but leave their value at 0.0 if the XML attribute values are implausible. - Before the loop which loads widgets from XMI add a loop which only parses the x and y values of the widgets and sets variables xNegOffset, yNegOffset, xPosOffset, yPosOffset to the minimum resp. maximum values encountered. After end of loop the members m_fixX and m_fixY may be altered depending on the [xy]{Neg,Pos}Offset values. - After the widget-load loop, if the calculated m_maxX, m_maxY exceed canvasWidth or canvasHeight then call setSceneRect with arguments x=0, y=0, w=m_maxX, h=m_maxY. umbrello/umlwidgets/umlwidget.cpp - In function loadFromXMI : - Local qreals nX, nY receive result of toDoubleFromAnyLocale(x) and toDoubleFromAnyLocale(y) respectively. - Local qreals fixedX, fixedY receive result of nX+umlScene()->fixX() and nY + umlScene()->fixY(). - Local qreals scaledX, scaledY receive result of fixedX * dpiScale and fixedY * dpiScale. - Add call to umlScene()->updateCanvasSizeEstimate() with arguments scaledX, scaledY, scaledW, scaledH. umbrello/umlwidgets/associationline.cpp - In function loadFromXMI, on initializing nX add umlScene->fixX() and on initializing nY add umlScene->fixY(). M +185 -7 umbrello/umlscene.cpp M +12 -2 umbrello/umlscene.h M +3 -2 umbrello/umlwidgets/associationline.cpp M +13 -5 umbrello/umlwidgets/umlwidget.cpp https://invent.kde.org/sdk/umbrello/commit/d8fe02e4f1f963d67fdfc7072ca8cc9c4292b0d9 -- You are receiving this mail because: You are watching all bug changes.