MarkerClustererPlus: Event when marker is shown / hidden in cluster? - google-maps-api-3

When using MarkerClustererPlus - I would like to hang some code on an event that is triggered when a marker that is in a cluster is shown / hidden by the markerClusterer.
MC+ Doco doesn't seem to indicate such an event.
Looking at the MC+ code it appears that the clusterer uses marker.setMap() and markers don't have a "map_changed" event.
I could add code to the clusterer to trigger an event whenever a marker.setMap is invoked but I'd rather not alter code that works so well - don't want to create a configuration management problem whenever markerClustererPlus is updated.
Any suggestions?

Shortly after posting the question, I discovered that I could hang an event on marker, 'map_changed'.
google.maps.event.addListener(myMarker, 'map_changed',
function() { do stuff });
I think this is an MVC state change event rather than an explicit marker event (i.e. it isn't defined as a marker event in the documentation).
(see Google event doco here) and Google marker event doco here
The only remaining question is - it would be nice to verify that this is an MVC state change event rather than an undocumented / unsupported marker event that could break or disappear - How can I do that?

Related

Show all-day events as a background color

Is there a way to show certain events in my calendar as full background blocks of color? For example, if an event is an all-day event, it's date square will have a background color of red. All other events will look like normal events.
(Im using FullCalendar synched to a google calendar)
To make an event appear as a full block of colour within its slot the way you described, you can use the "background" events feature. Since you're using Google Calendar and don't have full control over the JSON data provided, you'll have to add the necessary property via the eventDataTransform callback, which allows modification of the event data after it's been downloaded but before it's rendered onto the calendar. Something like this I think (as an option in your calendar config):
eventDataTransform: function(event)
{
if (event.allDay == true) event.rendering = "background";
return event;
}
See https://fullcalendar.io/docs/eventDataTransform and https://fullcalendar.io/docs/background-events for details.
use rendering: 'background' in events

Fullcalendar - slow button click response

I'm using Fullcalendar v2.4.0 and related plugin Scheduler v1.0.2 with all required dependencies. jQuery-ui is at v1.11.4.
I'm loading resources via Ajax call using Fullcalendar built-in method of:
resources: {
url: 'resources_feed.php',
type: 'POST'
}
resources_feed.php simply returns few lines of dummy data.
And for the events, using a similar built-in method of:
events: {
url: 'events_feed.php',
type: 'POST'
}
events_feed.php returning few lines of dummy data.
It all works as expected until I plug in more realistic large amount of data as resources but still keeping the events data same.
The problem I experience is that button clicks like views (Day, Week, Month), Today and left/right arrows are responding after a delay of min 2 seconds sometimes longer. It behaves as if there's a delay set for a few seconds between button click and event firing. I tried to put an alert in the onClick event and alert is displayed after this few second delay.
I tested another button outside Fullcalendar object but on the same page and that works as expected, ie firing as soon as you click the button. This rules out page or jQuery issues. Same behaviour in Firefox and Chrome.
If I switch resource loading back to dummy data then buttons start firing as soon as clicked.
I can't figure out why a large amount of data still to be fetched can affect button response even before triggering an Ajax call.
Anyone seen this before? Any pointers will be much appreciated.
Regards.
Looks like the issue is on your events_feed.php maybe you are loading all the data on every call. Maybe you are not catching properly the Start and End parameters on every button.
The feed.php should catch the start and the end on every call. Something like this:
$start = $_GET['start']);
$end = $_GET['end']);
// then select database
I had this problem when i started to use fullcalendar.
Hope it helps!

How do I capture the rightclick event for a FusionTablesLayer?

Following Google's documentation:
https://developers.google.com/maps/documentation/javascript/reference#FusionTablesLayer
https://developers.google.com/maps/documentation/javascript/reference#FusionTablesMouseEvent
There doesn't seem to be any documented way of capturing a rightclick event on a FutionTablesLayer like there is on the Map object. Has anyone figured out how to capture a rightclick (or contextmenu) event?
Even getting the x/y coordinates in pixels would be helpful since I could use those to find the latlng and query the FusionTable myself somehow... but it looks like the rightclick event on the Map is canceled or prevented from firing.
I'm afraid this is not possible.
The map would respond to the rightclick when you set the clickable-option of the layer to false, but this wouldn't help you much, because the latLng-property would contain the click-coordinates on the map and not the position of the marker.

re-draw fullCalendar on the fly

I want the fullCalendar to redraw itself (all the structure and events) without reloading the page.
Scenario:
I am using a patch of fullCalendar that supports the Resource View. For a few user actions I want to change the resources. But I don't want to reload the page.
You could 'destroy' and 'render' the calendar as a whole. But that might be cumbersome - especially in older browsers.
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar('render');
If you don't actually need to render the table, but just rerender the events again, you could use the 'rerenderEvents' method:
$('#calendar').fullCalendar('rerenderEvents');
Hopefully this helps!
Use refetchResources: .fullCalendar( 'refetchResources' )
This will fetch and freshly re-render the resource data, per the FullCalendar documentation.
The problem:
"...The problem is that the calendar is initialized while the modal or div is not visible... " based on this link enter link description here
In my opinion, destroy is not needed in this case, only with render you can see the calendar.
My solution:
<script type="text/javascript">
$('#objectname').show(0,onObjectShow);
function onObjectShow(){$('#calendar').fullCalendar('render');}
</script>
You must to be sure that the object(container of calendar) is fully visible. For example, my first mistake was to put this code on "onClick" event, and click event is triggered before show the object container and has no effect.
Solution Based on this reference.
You can also redraw calendar on the fly using below command-
$(window).trigger("resize");

Google maps event problem with flex actionscript

I am able to render a google map on a flex canvas. I create the map using the code below and then place markers on it in the onMapReady method (not shown)
var map:com.google.maps.Map=new com.google.maps.Map();
map.id="map";
map.key="bla bla";
_mapCanvas.addChild(map);
map.addEventListener(MapEvent.MAP_READY,onMapReady);
It all works fine. However, if I remove the map and then set _mapCanvas to null, then run exactly the same code again, the onMapReady event does not fire. It is weird, but once a map has been created and deleted, the onMapReady event never seems to fire again.
Anyone got any ideas?
Thanks.
I still don't know why this was happening, but I worked around the issue by creating the map as an application-level variable, only instantiating it once, and then adding and removing it from canvases as required. Not ideal, but at least I can now display and remove a map dynamically, even if it exists in memory between invocations.

Resources