[OpenLayers-Trac] Re: [OpenLayers] #3276: Missing dependencies for
Map and DragPan
OpenLayers
trac-20090302 at openlayers.org
Wed Apr 27 09:21:28 EDT 2011
#3276: Missing dependencies for Map and DragPan
-------------------------------+--------------------------------------------
Reporter: jpulles | Owner:
Type: feature | Status: reopened
Priority: minor | Milestone: 2.12 Release
Component: general | Version: SVN
Resolution: | Keywords:
State: Needs Discussion |
-------------------------------+--------------------------------------------
Comment(by erilem):
Replying to [comment:2 jpulles]:
> Sorry to reopen this issue as 'needs discussion', but I would like to
argue that the requires statements should reflect what is in code.
Alternatively, to the design decision can be noted in the file header.
>
> For DragPan the defaults are that Kinetic is not required, so this is
ok.
> For Map.js however, the default code requires a Navigation control a.o.
If the code would check for availability of these classes, the lack of
@requires would be correct.
I'd be +1 on changing the code of {{{OpenLayers.Map}}}, to add
{{{Navigation}}}, {{{PanZoom}}}, {{{ArgParser}}} et {{{Attribution}}}
controls only if their constructors are available. With something like
this:
{{{
if(this.controls == null) {
this.controls = [];
if(OpenLayers.Control) {
var names = ["Navigation", "PanZoom", "ArgParser", "Attribution"];
for(var i=0, len=names.length; i<len; i++) {
var ctor = OpenLayers.Control[names[i]];
if(ctor) {
controls.push(new ctor());
}
}
}
}
}}}
(Untested)
--
Ticket URL: <http://trac.openlayers.org/ticket/3276#comment:3>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list