samyeyo / LuaRT

Open source Windows programming framework for Lua
https://www.luart.org
Other
285 stars 17 forks source link

Bug in examples/zoom.wlua. Demo not working as expected #213

Open cosme12 opened 2 months ago

cosme12 commented 2 months ago

Hey, I was checking the examples and found a bug in the zoom.wlua example. You can see it's not working. If I'm not wrong the idea of the example is to make an image slowly increase in size by using the resize() method.

The problem is that when you execute resize with a factor of 0, the picture width and height goes to 0. Any subsequent resize of the image has no effect due to the fact that resize works on current dimensions (current_widht=0 * 5 = 0). The original width and height got lost in the first resize.

Possible solutions:

  1. Add new properties to Picture widget so it saves it's original original_width and original_height or maybe zoom
  2. Rework the example

Hope I'm clear with the explanation. And awesome project btw!

samyeyo commented 2 months ago

There's something wrong with the Picture:resize() method you are right. Thank you for the report I will dive into it;