[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KoCanvasController::ensureVisible (was koffice)
From:       Cyrille Berger <cberger () cberger ! net>
Date:       2010-07-15 20:13:06
Message-ID: 201007152213.08388.cberger () cberger ! net
[Download RAW message or body]

On Thursday 15 July 2010, Thomas Zander wrote:
> Hi Cyrille,
> 
> could you please clarify what you mean with;
>   «now the API of KoCanvasController is rather inconsistent, using
>   sometime view coordinate and sometime document coordinate. »
> as I wrote in my commit message, view coordinates are used everywhere in
> the controller API, after my change I was under the impression there is no
> longer anywhere that document coordinates are used in the API of the
> KoCanvasController. So they should be completely consistent now.

Well maybe it is API documentation that is wrong, the documentation of 
KoCanvasController::zoomIn mention document coordinate, while zoomOut and 
zoomBy "pixel" coordinate (whatever that is). Looking further it seems like 
those functions works in view coordinate, and that the API is wrong (fixed now, 
I have also replace pixel by view to be more explicit).

Also a few signals emit information in document coordinates.
 
> I apologize if you feel this should have gotten review; it looked like a
> rather obvious API bugfix and I have the impression that 99% of the times
> the ensureVisible is called by the KoCanvasBase which API has not changed,
> limiting the impact outside of flake.
Well to be honest, this makes it even more confusing and dangerous since two 
functions with the same name in two classes that are very tied takes a 
different reference. I would argue they should have the same unit (view or 
document, I don't care, I would think that view coordinates should be well 
hidden inside the canvas, but I don't have a strong opinion).

Also as far as I can see (according to API dox), KoCanvasBase has:
* updateCanvas, ensureVisible use document coordinates
* documentOrigin uses view coordinates

-- 
Cyrille Berger
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic