Announcement

Collapse
No announcement yet.

How to change the size of the Image Object relative to the mouse cursor?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change the size of the Image Object relative to the mouse cursor?

    Hello!
    I'm trying to change the size of the Image Object by scrolling the mouse wheel.
    I can't get resize the Image Object relative to the mouse cursor (using On Mouse Wheel event).
    Can anybody help?
    Thanks in advance.
    Attached Files

  • #2
    You can use the On Mouse Move event to track the current position of the mouse, and store the e_X and e_Y event variables in globals, so you can correct (center) the image after resizing it, or you can use System.GetMousePosition() directly in your On Mouse Wheel event script to retrieve the current mouse position.

    You get the current image size with Image.GetSize() or Image.GetProperties() (or you may even have it as the result of a previous calculation), and set the position with Image.SetPos(). The rest is very simple math, right?

    If you can't get this working, post your project (*.apz).

    Ulrich

    Comment


    • #3
      A little more and it will work.
      But it seems I do not understand something.
      Here's my project.
      Attached Files

      Comment


      • #4
        I edited your code, deleting the On Mouse Button script, and changing the On Mouse Move and On Mouse Wheel event scripts. I also initialize a couple of global variables in the On Show script. Now turning the wheel changes the size of the image, keeping it centered in relation to its previous position. Clicking and moving the mouse will drag the Image object on the Page. I am sure that you can continue from here.

        Ulrich
        Attached Files

        Comment


        • #5
          Thank you very much for your help!
          I will gain experience, learning from professionals like you.

          Comment

          Working...
          X