xnview wrote:m.Th. wrote:
For both very common scenarios from above the splitter should optionally behave like this:
http://www.catchmyfame.com/catchmyfame- ... er-plugin/
(move the splitter in the middle of photos to see the effect)
In fact the only code needed is the one which will make the second photo 'static' - IOW substract from the 2nd photo's LeftX the SplitterX distance on which splitter is moved (distance positive to right, negative to left). In fact at the link above there is the source code in JavaScript on how to do it. As always, the programmer needs to be attentive at bounds, margins etc.

ok, for 2 images, but for 3 or 4??
Pierre, it's a tool. For us.
Is not a critical exam in order to see that you can cover all the situations.
Let's define x1, x2, x3, x4 the left coordinates of each photo. In the same way, let's have the y1, y2, y3, y4 for top coordinates.
Also, let's define the d1, d2, d3, d4 the moving distances (if exist) for each splitter (if exist).
Let's start with the simple, known case:
What do we must add for 2 photos?
In the splitter's AfterMove signal (or in a similar place)
we must 'simulate' that the next photo (img2) is staying. Hence: x2 := x2-d1; That's all.
In the case of 3 photos what we have?
If the 1st vertical splitter is moving
we must 'simulate' that the next photo (img2) is staying. Hence: x2 := x2-d1;
If the 2st vertical splitter is moving
we must 'simulate' that the next photo (img3) is staying. Hence: x3 := x3-d2;
The key word here is "
next" - you must act only on the 'next' photo: the "next" photo is the photo at the right of the splitter.
In the case of 4 photos:
Let's say that we have the images like this:
Code: Select all
img1 | img2
-----+-------
img3 | img4
You have some paths:
1. I would put in the form/tab only 2 (two) vertical splitters and one horizontal splitter. The vertical splitters will work like above (one on the img2: x2 := x2 - d2; and one on img4: x4 := x4 - d4). The horizontal one will be a 'classical' one, no code required.
2. Again, 2 vertical splitters and one horizontal splitter. The vertical splitters work like above. The horizontal splitter will work on BOTH images at bottom: y3 := y3 - d3; AND y4 := y4 - d3; (d3 in both formulas since we have a single horizontal splitter)
3. Implement a quad splitter, like this one:
https://qt-project.org/forums/viewthread/7308
The formulas will be the same. The quad splitter acts on img2, img3 and img4:
x2 := x2 - d2; x4 := x4 - d2; (the horizontal distance is the same for both photos)
y3 := y3 - d3; y4 := y4 - d3; (the vertical distance is the same for both photos)
m. Th.
- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -