Registered Member
|
I needed a modification to horizontal image flip, such that my drawing pointer stays at the same pixel after mirroring, so that I dont have to pan the image to go back to the position I was working on. Its not a problem if I zoom out enough, but it is when zoomed in.
I tried canvas mirror instead of flipping image, but it gives weird behavior. Sometimes it keeps the image at roughly same position (few pixels drift), but sometimes it drifts too far. So I wrote a function (in python), which performs image flipping but keeps the pixel under the cursor. It does this by readjusting the horizontal scroll of the canvas. Posting the code of that function here in case someone finds it useful, or if someone can suggest a better method, or maybe something like this exists already and I overlooked it.
|
Registered Member
|
Seems like krita changes its ui hierarchy, this hack didn't work anymore
|
Registered Member
|
I just tested this, seems to work fine. Can you elaborate what went wrong ? Was there any error messages too ? |
Registered Member
|
Thanks for your reply!
I think I know where it goes wrong. I run the script in the krita internal scripter, so maybe the window is lose focus
Code break on these 2 lines, now I fix it, thanks! By the way, i notice CANVAS_GET_ZOOM_FIX=3.0/12.5, is this magic number is a constant in krita source code? Seem zoom must multiply this number can return the right result. |
Registered Member
|
Sorry, got caught up with something, so couldnt reply sooner. Yeah, you are right on both accounts. This code only makes sense if that window is on focus, and that constant is a magic number. Without that constant I wasnt able to get zoom right, and it was always off by that factor. I didnt look into the source code, I just observed (by good old print statements lol) that the ratio of zoom i want vs zoom I am getting is fixed but not 1, or atleast thats what I hazily remember. I wrote this long time ago. |
Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]