Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f3695e7

Browse files
committed
[[ svgpath ]] Don't recalculate scaled width & height if widget dimensions are unchanged
This patch reduces the work done by the svgpath widget's OnGeometryChanged handler by checking first if the width or height of the widget has changed before recalculating the scaled dimensions of the svg path
1 parent 8ffaee1 commit f3695e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extensions/widgets/svgpath/svgpath.lcb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ private variable mAngle as Real
4747
private variable mFillRule as String
4848
private variable mScaledWidth as Real
4949
private variable mScaledHeight as Real
50+
private variable mWidth as Real
51+
private variable mHeight as Real
5052

5153

5254
/**
@@ -303,7 +305,11 @@ end handler
303305
----------
304306
-- this handler is called when the widget is resized
305307
public handler OnGeometryChanged()
306-
CalculateScaledSizes()
308+
if my width is not mWidth or my height is not mHeight then
309+
CalculateScaledSizes()
310+
put my width into mWidth
311+
put my height into mHeight
312+
end if
307313
end handler
308314
----------
309315

0 commit comments

Comments
 (0)