fix viewport location limits
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
2ee01e71c9
commit
a941056db4
1 changed files with 8 additions and 2 deletions
|
@ -269,8 +269,14 @@ mouse.listen.window.btn.middle.onpaint.on((evn) => {
|
|||
viewport.cy = worldInit.y + (evn.iy - evn.y) / viewport.zoom;
|
||||
|
||||
// Limits
|
||||
viewport.cx = Math.max(Math.min(viewport.cx, imageCollection.size.w), 0);
|
||||
viewport.cy = Math.max(Math.min(viewport.cy, imageCollection.size.h), 0);
|
||||
viewport.cx = Math.max(
|
||||
Math.min(viewport.cx, imageCollection.size.w - imageCollection.origin.x),
|
||||
-imageCollection.origin.x
|
||||
);
|
||||
viewport.cy = Math.max(
|
||||
Math.min(viewport.cy, imageCollection.size.h - imageCollection.origin.y),
|
||||
-imageCollection.origin.y
|
||||
);
|
||||
|
||||
// Draw Viewport location
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue