• Resolved chris7711

    (@chris7711)


    Is there at least a possibility to add a label to a marker? The ID or name…
    The plugin is really nice, but when having 5 different users on one map, it is impossible to know who is who.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author tinuzz

    (@tinuzz)

    Hi,

    Can you clarify what exactly you have in mind for a ‘label’?

    Best regards,
    Martijn.

    Thread Starter chris7711

    (@chris7711)

    With label I meant the same thing as with the popups. So that the name is visible all the time and over each dot a name (a label) is seen

    Plugin Author tinuzz

    (@tinuzz)

    Isn’t this actually the same question as in the other topic?

    While this isn’t in Trackserver right now, it’s really easy to accomplish.

    In trackserver.js, find the infobar code, which looks something like this in summarized form:

    if (mymapdata.is_live) {
       if (track_id == follow_id) {
         if (mymapdata.infobar) {
           if (alltracks && alltracks[track_id]) {
             metadata = alltracks[track_id].metadata;
           }
           else {
             metadata = _this.get_mydata(div_id, track_id, 'metadata');
           }
           ...
           mymapdata.infobar_div.innerHTML = infobar_text;
         }
       }
     }
    

    If you pull the metadata assigment two levels up, you can very easily add a tooltip to the end_marker:

    if (mymapdata.is_live) {
       if (alltracks && alltracks[track_id]) {
         metadata = alltracks[track_id].metadata;
       }
       else {
         metadata = _this.get_mydata(div_id, track_id, 'metadata');
       }
       if (track_id == follow_id) {
         if (mymapdata.infobar) {
           ...
           mymapdata.infobar_div.innerHTML = infobar_text;
         }
       }
     }
     end_marker.bindTooltip(metadata.userlogin).openTooltip();
    

    That last line adds a tooltip with the user’s login name. You can als use the display name:

    end_marker.bindTooltip(metadata.displayname).openTooltip();

    or any other information that is available in the metadata.

    Does that help?

    Best regards,
    Martijn.

    Thread Starter chris7711

    (@chris7711)

    Thank you for the reply.

    I guess that’s very easy if you are good with javascript ;), I am not…

    I tried to change that how I understand it from above, now the map isn’t showing anymore. However, I think it is my fault and I changed trackserver.js how I understood it from above, but it seems I haven’t understood it :)).

    I changed the file again to the original and the map is back.

    Thread Starter chris7711

    (@chris7711)

    Can be closed, it is working now ??

    Plugin Author tinuzz

    (@tinuzz)

    Glad you got it working! If you still want me to add this to Trackserver, please create e feature request issue on Github.

    https://github.com/tinuzz/wp-plugin-trackserver/issues

    Cheers,
    Martijn.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Label Marker’ is closed to new replies.