5E Product Walkthrough Playlist
  1. #1

    How do you open a map and then zoom in to an area or point?

    The imagecontrol.setViewpointCenter(viewx, viewy, [zoom]) refuses the zoom argument no matter what value I use. I have to set the map (image) zoom before I call this in order for it to properly center - as opening the map always opens it to the max map size (when I'm trying to center on a smaller part of it).

    [beginning to wonder if dev's are on holiday still as nothing seems to be answered anymore (sigh)]
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    Yes, both away on holidays; as well as working on many, many changes in both the FGU client as well as the rulesets.

    From a quick look at the code for that API, it looks like it accepts a Lua number for the #3 parameter.
    For FGU,
    If the value specified is less than or equal to zero, then the image acts as if Zoom to Fit button pressed.
    If the value is greater than zero, then the zoom is applied. A value of 1 equals one pixel in image to one pixel on screen. (at least at 100% UI scale)

    However, this parameter is not used in any official rulesets, so may not have been exercised. What values are you trying to set it to? And for what purpose?

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    Yes, both away on holidays; as well as working on many, many changes in both the FGU client as well as the rulesets.

    From a quick look at the code for that API, it looks like it accepts a Lua number for the #3 parameter.
    For FGU,
    If the value specified is less than or equal to zero, then the image acts as if Zoom to Fit button pressed.
    If the value is greater than zero, then the zoom is applied. A value of 1 equals one pixel in image to one pixel on screen. (at least at 100% UI scale)

    However, this parameter is not used in any official rulesets, so may not have been exercised. What values are you trying to set it to? And for what purpose?

    Regards,
    JPG
    I have an extension that allows CT entries to be controlled in the CT (visible, etc.) by a group name. Double clicking on the field that shows the current group name being worked on would take all the tokens in that group - determine the first image (map) it found in the tokens - and then take all the x,y coords of the tokens (in that same map - if any) to get a mid point of them all - and bring up the image (map) with that group of tokens visible. In other words, double click on field and poof map pops up with the relevant tokens centered and zoomed in. That was my intent. Which I accidently - sort of achieved - but don't know how. When the following code is executed and the map is not currently up, it will bring up the map fitted to the window. Not what I want. Double clicking on field again (or when map is already up) will center the map and zoom into a reasonable fit of all the tokens. Most times. And that's the problem - I tried all sorts of numbers - all sorts of zoom factors - it only ever worked for me in the manner I described with 1.0 as the zoom. And only on the first double click while map is up - any further ones do nothing (goes through same code here).
    I don't understand how this function works. Even though it does work for me now in almost all cases - in the way I described.

    The code is as follows (why it works if map is already up - and doesn't if its not - I have no idea - and thus - don't understand the mechanics of zooming and centering the window with this function):

    Code:
    		local w = Interface.openWindow("imagewindow", lastsRecord);
    		if w then
    			-- find average view center point
    			local x = (highX - lowX)/2 + lowX;
    			local y = (highY - lowY)/2 + lowY;
    			--Debug.console("(highX[" .. tostring(highX) .. "]) - lowX[" .. tostring(lowX) .. "])/2 + lowX = " .. tostring(x));
    			--Debug.console("(highY[" .. tostring(highY) .. "]) - lowY[" .. tostring(lowY) .. "])/2 + lowY = " .. tostring(y));
    			local zoom = 1.0;
    			-- can't figure out how to get zoom to work at all - must have opened map for center to work 
    			w.image.setViewpointCenter(x,y,zoom);
    		end
    I really wish I could just window area (fit to area) - or something similar.
    Last edited by SilentRuin; January 16th, 2021 at 05:38.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  4. #4
    Zoom is just a scaling factor; and is affected by the mouse wheel during regular usage. You could get the zoom data after using the mouse wheel, to get an idea of the zoom data points in actual use. Then, work from there. However, the images are zoomed to fit automatically on first open, so this may impact things as well in terms of initialization order.

    My guess is that you might be able to get close by looking at samples, and extrapolating zoom points; but it might not work when opening a new window.

    To be honest, at this point, it's not something that I have plans to change or investigate further at this time, due to resource constraints.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    Zoom is just a scaling factor; and is affected by the mouse wheel during regular usage. You could get the zoom data after using the mouse wheel, to get an idea of the zoom data points in actual use. Then, work from there. However, the images are zoomed to fit automatically on first open, so this may impact things as well in terms of initialization order.

    My guess is that you might be able to get close by looking at samples, and extrapolating zoom points; but it might not work when opening a new window.

    To be honest, at this point, it's not something that I have plans to change or investigate further at this time, due to resource constraints.

    Regards,
    JPG
    Well the code I delivered gets the best results with a map up - or on the second double click - so that's what I've delivered. Or I suppose - put in my extension - is a better description right now. So I'll stick with that as my best way of doing an approximate. Something is better than nothing and you can always mouse wheel out if it comes in too close on 2nd double click (which only one map of several tests I did had happen).
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in