[OpenLayers-Trac] Re: [OpenLayers] #3185: canvas: drawExternalGraphic either misplaced or not drawn

OpenLayers trac-20090302 at openlayers.org
Mon Apr 4 05:29:37 EDT 2011


#3185: canvas: drawExternalGraphic either misplaced or not drawn
-----------------------------+----------------------------------------------
 Reporter:  rduivenvoorde    |       Owner:  tschaub     
     Type:  feature          |      Status:  assigned    
 Priority:  minor            |   Milestone:  2.12 Release
Component:  Renderer.Canvas  |     Version:  2.10        
 Keywords:                   |       State:              
-----------------------------+----------------------------------------------

Comment(by rduivenvoorde):

 Work done for r11581 is not related to this ticket/patch.

 I have updated patch for the newer Canvas code.

 It still solves two problems:

 ad 1) it actually defines a default value for the width and height of the
 graphic (without this ticket, a style like

 default:{externalGraphic: "img/marker-gold.png"}

 will NOT show the marker because it will have NO width or height. With the
 patch it will at least be shown with the default width and height of 20x20
 (width and height is also more important now for hit-detection).

 ad 2) the code for drawing the external graphic was not taking into
 account the width/height of the graphic itself when applying an offset, so
 the style

 default:{externalGraphic: "img/marker-gold.png", ,graphicXOffset: 20}

 versus

 default:{externalGraphic: "img/marker-gold.png", ,graphicXOffset: -20}

 were not mirrored. The positive offset is drawn half the size of the image
 too much while the negative offset is drawn half the size image too few.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3185#comment:4>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list