Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4074894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:13:45+00:00 2026-05-20T17:13:45+00:00

I am finding the current X and Y position in ‘ touchend ‘ event.

  • 0

I am finding the current X and Y position in ‘touchend‘ event. Now say the original position of ImageView is ; left=100 and top=100. On touchend it just gives value in 2 digits that is either 8,10 or 9,11 etc. Now I am not sure what’s the offset of image view. If it is lastLeft+x and lastTop+y then it’s not gonna work at all. What all I want to save current position of Image at TouchEnd in Db so that I could restore it later.

Kindly help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:13:46+00:00Added an answer on May 20, 2026 at 5:13 pm

    My original answer was incorrect: here’s an updated version.

    The globalpoint property in the event object contains the coordinates on the screen that the user clicked on, while the x and y properties are the coordinates within the view at which the user clicked. By taking one away from the other (and, depending on whether your screen has a status bar, allowing for that too) you can work out the top/left of the object after an animation finishes.

    I’ve put together a demo that works in 1.6.0 which demonstrates this (just create a new project and replace app.js with the following code)

    // Windows
    var window = Ti.UI.createWindow();
    
    var image = Ti.UI.createImageView({
        url: 'KS_nav_ui.png',
        width: 100,
        height: 100,
        top: 0,
        left: 0,
        backgroundColor: '#f00'
    });
    
    image.addEventListener('touchstart', function (e) {
    
        var left = e.globalPoint.x - e.x,
            top = e.globalPoint.y - e.y - 20; // The 20 accounts for status bar
    
        Ti.API.info('Starting left: ' + left);
        Ti.API.info('Starting top: ' + top);
    
    });
    
    image.addEventListener('touchmove', function(e) {
    
        var newX = e.x + image.animatedCenter.x - image.width/2;
        var newY = e.y + image.animatedCenter.y - image.height/2;
    
        image.animate({center:{x:newX,y:newY}, duration:1});
    
    });
    
    image.addEventListener('touchend', function (e) {
    
        var left = e.globalPoint.x - e.x,
            top = e.globalPoint.y - e.y - 20; // The 20 accounts for status bar
    
        Ti.API.info('Finishing left: ' + left);
        Ti.API.info('Finishing top: ' + top);
    
    });
    
    window.add(image);
    
    window.open();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you can see in the current code below, I am finding the duplicate
I've recently had to uninstall/re-install my .NET Framework 4 after finding my current installation
In finding string in the current buffer, I know that we can use C-s
In a current project I need to support finding a User by login credentials
I want to convert my current latitude,longitude text into speech.I have code for finding
I have a problem with finding the current color under the cursor. My code:
I have a code for finding user current location.When i was running my code
What are the possible solutions for finding the current active language which appears on
Is there a simple way of finding out the current value of a specified
I have problem in finding the current opened application name. I used ApplicationManager class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.