×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Centering the markers after switching screen mode

Centering the markers after switching screen mode 12 years 9 months ago #12947

  • Eliecer Marchante
  • Eliecer Marchante's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 493
  • Karma: 11
  • Thank you received: 13
Hi Daniel,

I wanna center the marker automatically when I am switching between screen modes.

Example:
- Once i click on 'Resize the map' ( Full Screen ), I want to center the markers automatically, and If I am going back to normal size, I want to center the markers again, but this time to the smaller screen size.

What's the code I have to add?


Thanks in advance.

Centering the markers after switching screen mode 12 years 9 months ago #12982

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Open Hotspots.Layout - we have the events
onFullScreen: function() {},
		onNormalScreen: function() {},
(line 24 and 25)

As you can see we don't do anything, but you could change it to
onFullScreen: function() {this.dataClass.map.zoomToMarkers();},
		onNormalScreen: function() {this.dataClass.map.zoomToMarkers();},

And now the map will center around your markers... I still think that this is a bad idea from usability perspective, but it is your decision... At the end if I want the map centered, I can click the button!

Centering the markers after switching screen mode 12 years 9 months ago #13032

  • Eliecer Marchante
  • Eliecer Marchante's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 493
  • Karma: 11
  • Thank you received: 13
I would like to use a conditional in this case:

if actualzoom = start zoom of the map
{
        onFullScreen: function() {this.dataClass.map.zoomToMarkers();}, 
        onNormalScreen: function() {this.dataClass.map.zoomToMarkers();}, 
        }
        else
        }
        onFullScreen: function() {}, 
        onNormalScreen: function() {}, 
        };

Is that possible?

Centering the markers after switching screen mode 12 years 9 months ago #13034

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Why don't you start learning javascript :) It is possible, but I don't know the name of the function to get the zoom level of the function. Look at the google maps API doc.
After taht it should be
if(this.dataClass.map.GETZOOM() == this.options.mapStartZoom.toInt()) ....

I start to understand less and less why you want such modifications...

Centering the markers after switching screen mode 12 years 9 months ago #13037

  • Eliecer Marchante
  • Eliecer Marchante's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 493
  • Karma: 11
  • Thank you received: 13
:=D
You are right, I should learn Javascripts or the second option could be to stop with the complaints :lol:

Once I go to my site , I get this:


Once I click on full screen icon, I am getting this:


The dark area is the empty space I am getting, and once i click on 'marker center', the problem is solved. With the conditional I was talking about, this problem will be solved. :D

Once I have time :/ , I will check the javascript 'puzzle' to see if i can solve it, otherwise i will stay with the second option :D
  • Page:
  • 1
Time to create page: 0.114 seconds