-
November 1st, 2020, 17:22 #11
- Join Date
- Jan 2020
- Posts
- 222
Ok, maybe Zoom to Fill could help me...
-
November 1st, 2020, 17:31 #12
- Join Date
- Jan 2020
- Posts
- 222
Oh, and thanks again Moon Wizard.
-
November 1st, 2020, 19:03 #13
- Join Date
- Jan 2020
- Posts
- 222
If you don't mind helping me understand one more thing...
How come this code moves the image within the window? Based on the descriptions of the functions in the wiki, reading the current viewport and then setting the center with the same values should not move the image in the viewport. But it does. Not always, but certainly with any image that I added to the database records myself (eg. dragging from Assets to Maps list).
Code:local vpX, vpY, vpZoom = image.getViewpoint(); image.setViewpointCenter(vpX, vpY, vpZoom);
getViewpoint
Returns data on the current viewpoint of the user. The viewpoint is determined by the center point of the portion of image being viewed in the control as well as the used zoom level.
Return values
(number)
The X coordinate on the image acting as the center point of the viewpoint(number)
The Y coordinate on the image acting as the center point of the viewpoint(number)
The zoom level being used (a value of 1.0 represents 100% zoom)
setViewpointCenter
Sets the active viewpoint of the user to center on the . The image viewpoint is repositioned so that the given coordinates on the image are centered in the control with the specified zoom level active.
Parameters
viewx (number)
The desired horizontal view point center coordinate
viewy (number)
The desired vertical view point center coordinate
zoom (number) [optional]
The zoom level as a decimal number, with 1.0 being 100% zoomLast edited by zuilin; November 1st, 2020 at 19:08. Reason: more information
-
November 1st, 2020, 20:48 #14
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,678
The current view point is defined as the center point of the view plus the zoom scale. When you call get/set, you are just setting the exact same information back into itself.
Regards,
JPG
-
November 1st, 2020, 23:42 #15
- Join Date
- Jan 2020
- Posts
- 222
-
November 2nd, 2020, 03:10 #16
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,678
I just pre-empted one of the toolbar buttons in the CoreRPG image toolbar with the following code:
function onButtonPress()
local ic = window.getImage();
local vX, vY, vZoom = ic.getViewpoint();
ic.setViewpointCenter(vX, vY, vZoom);
Debug.chat("OLD: ", vX, vY, vZoom);
Debug.chat("NEW: ", ic.getViewpoint());
end
With this code on my maps, I do not see any movement when I press the button.
Example:
s'OLD: ' | #1.58316040039063 | #18.5975341796875 | #0.816916465759277
s'NEW: ' | #1.58316040039063 | #18.5975341796875 | #0.816916465759277
Are you sure that you are not changing the values between the get and set at all?
Regards,
JPG
-
November 2nd, 2020, 03:49 #17
- Join Date
- Jan 2020
- Posts
- 222
Well sonofa. For some reason, now it works perfectly. Nothin' moves. I don't get it. I had restarted FGU a number of times while testing, too, and it was still doing it. But it's not now. Cache? Solar flare?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks