DMsGuild Classic
Page 2 of 2 First 12
  1. #11
    Ok, maybe Zoom to Fill could help me...

  2. #12
    Oh, and thanks again Moon Wizard.

  3. #13
    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);
    Wiki says:

    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)
    and

    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% zoom
    In fact, it does work, but only after I execute it once. The first time it executes after opening the image window, it moves. After that, it stays put each time the code runs. It's like it doesn't know where to start, but once I set the center the first time, it has the right coordinates in the database. It really feels like there is something not set right somewhere in memory or the database or something when the image window is first opened.
    Last edited by zuilin; November 1st, 2020 at 20:08. Reason: more information

  4. #14
    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

  5. #15
    Quote Originally Posted by Moon Wizard View Post
    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
    That's my point. When I do that, the image moves. It shouldn't.

  6. #16
    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

  7. #17
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Joshua Stream Pre

Log in

Log in