Re: Bug with get_size() / set_size() in Points?



On Tue, Jun 19, 2012 at 6:44 PM, Pablo Castellano <pablo anche no> wrote:
> El 19/06/12 13:17, Jiří Techet escribió:
>> On Mon, Jun 18, 2012 at 2:35 PM, Pablo Castellano <pablo anche no> wrote:
>>> Hi.
>>>
>>> I think I have found a bug with set_size() and get_size().
>>>
>>> They don't work as expected with Points.
>>>
>>> I want to use it in order to draw points smaller when the map is
>>> zoomed-out. Getting the size of a point and then setting the size+1 or
>>> size-1 to this point doesn't draw it well.
>>> Instead, I get the expected behaviour by removing first the marker from
>>> the layer and then adding a new one with different size.
>>>
>>> I have isolated this issue into a Python example. You can get it from my
>>> libchamplain repo in github:
>>> https://github.com/PabloCastellano/libchamplain/tree/pablog
>>> https://github.com/PabloCastellano/libchamplain/blob/pablog/test2i.py
>>>
>>> I'm not very familiarized with Cairo/Clutter so I have no idea how to
>>> fix it ;(
>>
>> Hi Pablo,
>>
>> first thanks for doing the boring stuff and going through the
>> documentation and fixing various typos and copy/paste errors. Much
>> appreciated! Your new project looks interesting too!
>>
>> I've just had a quick look at the issue and you're right, this is a
>> libchamplain bug. From looking at the code the problem seems to be
>> that when you set the size, the size is only taken for cario drawing
>> but the size of the clutter actor into which the point is drawn is not
>> updated. So what happens is that the cario drawing is rescaled to the
>> clutter actor size (so at size 1 you get a grey square). It should be
>> pretty easy to fix - I'll have a look at it during the next weekend.
>>
>> Thanks,
>>
>> Jiri
>>
>
> Awesome! Thanks a lot! :)

It's a shame how much time it took me to sit down to write the patch
(10 days) in comparison to writing and testing the 5-line patch (5
minutes). Anyway, the patch is both in master and libchamplain-12
branch now and seems to be working correctly. I'd suggest to avoid odd
point sizes because they look ugly (I guess because of some rounding).

Jiri


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]