Ticket #2749 (new bug)
OpenLayers.Layer.clone() does not clone properties of Object type correctly
| Reported by: | aratcliffe | Owned by: | crschmidt |
|---|---|---|---|
| Priority: | major | Milestone: | 2.13 Release |
| Component: | Layer.Vector | Version: | 2.9 |
| Keywords: | Cc: | adube, zjames, belug | |
| State: |
Description
When cloning a Vector layer the source layer's protocol and any configured strategies will be copied by reference to the clone object. If the cloned layer's destroy() method is called the shared protocol and strategy objects will be destroyed and the source layer will cease to function.
A possible solution would be to implement a clone() method on both the Protocol and Strategy interfaces and use this method when cloning the layer e.g.
for(var property in source) {
var value = source[property]; if(value !== undefined) {
if(value.clone) {
value = value.clone();
} destination[property] = value;
}
}
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

