Ticket #984 (closed feature: wontfix)

Opened 6 years ago

Last modified 6 years ago

Attribution control does not allow external element to be used

Reported by: openlayers Owned by:
Priority: minor Milestone:
Component: Control Version: SVN
Keywords: attribution control Cc: grand.edgemaster@…
State:

Description

It would be nice if the Attribution control would allow an external div to be used, like the mouseposition control currently does.

For the short term in my personal code, I've created a wrapper class to implement it:

OpenLayers.Control.CAttribution = OpenLayers.Class(OpenLayers.Control.Attribution, {
  element: null,
  
  draw: function() {
    OpenLayers.Control.Attribution.prototype.draw.apply(this, arguments);
    if(this.element) this.div.style.display = "none";
  },
  
  updateAttribution: function() {
    OpenLayers.Control.Attribution.prototype.updateAttribution.apply(this, arguments);
    if(this.element) this.element.innerHTML = this.div.innerHTML;
  },
  CLASS_NAME: "OpenLayers.Control.CAttribution"
});

Change History

Changed 6 years ago by crschmidt

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

The Scale, Permalink and MousePosition controls all do this in a different way from the rest of the code. The way to do this is to pass in a 'div' object in the options of the control:

map.addControl(
  new OpenLayers.Control.Attribution(
    {'div': OpenLayers.Util.getElement('foo')}
  )
);
Note: See TracTickets for help on using tickets.