Ticket #751 (closed feature: invalid)

Opened 6 years ago

Last modified 5 years ago

Marker.Label

Reported by: openlayers Owned by:
Priority: minor Milestone: Future
Component: Marker Version: 2.5
Keywords: marker label Cc:
State: Needs More Work

Description

Using Marker you can add an icon, but not a text/caption/label. This component allows you to add support to it, defining the label and the style to be used. It's recomended to user a negative top to show it on top of the icon (be careful the IE6 does not correctly support it)

Attachments

Label.js Download (1.7 KB) - added by openlayers 6 years ago.
Label.2.js Download (5.7 KB) - added by jachym 6 years ago.
New version of the file
Label.3.js Download (6.6 KB) - added by jachym 6 years ago.
New methods
test_Label.html Download (4.5 KB) - added by jachym 6 years ago.
Tests for OpenLayers.Marker.Label

Change History

Changed 6 years ago by openlayers

Changed 6 years ago by jachym

  • version set to 2.5
  • milestone set to 2.6 Release

I have updated the code to OpenLayers 2.5, run it through jslint. File added. The labels do appear, when mouse over on the icon (can be turned off).

In styles.css, new entry should be added:

.olMarkerLabel {
    font-size: small;
    color: white;
    background-color: darkblue;
    width: auto;
    padding: 1px;
    border: 1px white solid;
    opacity: 0.7;
    z-index: 1000;
}

Changed 6 years ago by jachym

New version of the file

Changed 6 years ago by jachym

Other proposed changes:

OpenLayers/Layer/Text.js:


data['overflow'] = overflow || "auto";

+ data.label  = title;

OpenLayers/Feature.js:


- this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);

+ if (this.data.label) {
+       this.marker = new OpenLayers.Marker.Label(this.lonlat, this.data.icon, this.data.label,{mouseOver:true});
+ }
+ else {
+      this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
+ }

Changed 6 years ago by jachym

New methods

Changed 6 years ago by jachym

Tests for OpenLayers.Marker.Label

Changed 6 years ago by jachym

New file version, tests included.

Changed 5 years ago by crschmidt

  • state set to Needs More Work

The documentation strings here could definitely use some work: what is 'onlyOnMouseOver' supposed to mean? Also, this isn't right:

92 	     * icon - {<OpenLayers.Icon>}  the icon for this marker
93 	     * lonlat - {<OpenLayers.LonLat>} the position of this marker
94 	     * label - {String} the position of this marker
95 	     * options - {Object}

'label' is not the position of the marker.

An example file with a demonstration is a good idea for this one, and you haven't offered a patch that I can apply. I'm unlikely to review it until there is a patch that applies and adds the:

  • Marker/Label.js file
  • test file
  • Modifies run-tests
  • Modifies OpenLayers.js to include Marker/Label.js
  • an example via which I can see the output.

Changed 5 years ago by crschmidt

  • milestone changed from 2.6 Release to 2.7 Release

Mass ticket move to 2.7 post dev meeting. If you are actively working on this task, please update this ticket with information and change the milestone to 2.6. At the time of the next IRC meeting (most likely 1-31-08), this will mean the ticket can *not* be brought back into 2.6 unless there is further feedback.

Changed 5 years ago by crschmidt

  • milestone changed from 2.7 Release to Future

No current/ongoing development work. Moving to Future until someone expresses more interest.

Changed 5 years ago by jachym

  • status changed from new to closed
  • resolution set to invalid

This new addon is no longer needed, because of it can be implemented now using general popups. For example usage, you can use the popupsMatrix example, replace the

marker.events.register("click", feature, markerClick);

line with

marker.events.register("mouseover", feature, markerClick);
marker.events.register("mouseout", feature, markerClick);
Note: See TracTickets for help on using tickets.