regionChanged

You must Login before you can answer or comment on any questions.

I have 1 simple question:

Why does the 'regionChanged' change the zoom factor of a map.

Central.prototype.drawMap = function(parent_obj, zoom_lat, zoom_long) {
    parent_obj.map = Titanium.Map.createView({
        top : the_screen.getMapTop(),
        mapType : Titanium.Map.STANDARD_TYPE,
        animate : true,
        regionFit : true,
        userLocation : false,
        latitudeDelta : zoom_lat,
        longitudeDelta : zoom_long
    });
 
    parent_obj.win.add(parent_obj.map);
 
    return parent_obj.map;
}
this.the_map = central.drawMap(this, 0.05, 0.05);
this.the_map.addEventListener('regionChanged', function(e) {
        // I am not doing anything at all, so you think!!!!!!!
    });
Magic the zoom factor of the map has changed when you load it with say some points on it. What gives? This should not happen.

— asked 10 months ago by Steven Marshall
4 Comments
  • Are you saying that you get different results if you add the event listener or if you don't? In other words, remove this line, and run the code:

    this.the_map.addEventListener('regionChanged', function(e) {
            // I am not doing anything at all, so you think!!!!!!!
        });
    Do you see the same zoom level? Or does the mere presence of an event listener change the zoom level (doesn't seem likely)?

    — commented 10 months ago by Jason Priebe

  • Hi Steven

    You were asking a very similar question an hour before you asked this one - I know because I have just come back to look at it again since the last update on the previous question and noticed both of them.

    As your questions seem to suggest that by simply adding an event listener to respond to a regionChanged event are somehow affecting the zoom factor I am struggling to work out how unless you are adding code into that event handler that affects it. You were in the previous question.

    Can we try and boil down the question;

    Are you looking for a way to determine the current map deltas and center point - so that you can update your listing of these areas - so that each map looks just the way you want it to look later on?

    — commented 10 months ago by Malcolm Hollingsworth

  • The zoom level changes if you add the 'regionChanged' listener. Try it in kitten sink if you don't believe me!!!!

    — commented 10 months ago by Steven Marshall

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!