[OpenLayers-Trac] Re: [OpenLayers] #3441: Default opacity of layer

OpenLayers trac-20090302 at openlayers.org
Tue Aug 9 02:44:05 EDT 2011


#3441: Default opacity of layer
-------------------------+--------------------------------------------------
 Reporter:  mosesonline  |       Owner:  euzuro         
     Type:  bug          |      Status:  new            
 Priority:  minor        |   Milestone:  2.12 Release   
Component:  Layer        |     Version:  SVN            
 Keywords:  layer        |       State:  Needs More Work
-------------------------+--------------------------------------------------

Comment(by mosesonline):

 But it seems that the formats do bother about the opacity, they work with
 opacity null but not with 1. In a case where 1 is a documented value for
 the property and null the undocumented default value. My app handles the
 null value, because it has to, but why the format don't handle legal
 values for this option? I would change it if I could, but I'm not so into
 these classes. Maybe someone who wrote the classes could give a hint to
 fix it. I would try to fix the errors in the classes or should the null
 value stay?[[BR]]
 Why I think it should be fixed:[[BR]]
 The null value is sometimes "we don't bother", sometimes "oh, I forgot to
 set", sometimes "Make it visible" and sometimes "Don't show it", it is
 ambiguous. Ambiguous values lead to confusion and this leads to exceptions
 or errors.[[BR]]
 A layer is a visual component so it is always visible or not, and if it's
 visible it has an opacity(that's why the Layer-class has this attribute
 and not a subclass), if a client (class) doesn't bother it should not use
 this value.[[BR]]
 I cannot imagine a use case where the opacity of a layer must not be set,
 at least to a default value 1. I can imagine several cases where it is not
 used, but than I don't use it.[[BR]]
 The last thing is that it leads to more code, where the user has to deal
 an ambiguous value every time he wants to compute something with the
 opacity.

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


More information about the Trac mailing list