Yes, by registering a moveend listener on its layer the strategy will
only receive moveend events if the layer moveTo was called, i.e. if
the layer is visible and in range. This is making sense to me. What do
you guys think? Eric

2008/7/18, Pierre GIRAUD <[EMAIL PROTECTED]>:
> Hi all,
>
> I'm playing with the code in the vector-behavior sandbox.
> I found that the strategies (at least BBOX and Grid) don't check if
> the layer is in range.
>
> We can add code as following to support that :
> {{{
> Index: lib/OpenLayers/Strategy/Grid.js
> ===================================================================
> --- lib/OpenLayers/Strategy/Grid.js     (revision 7544)
> +++ lib/OpenLayers/Strategy/Grid.js     (working copy)
>  -276,7 +276,9 @@
>      refresh: function(evt) {
>          var bounds = this.layer.map.getExtent();
>          var force = evt.zoomChanged || evt.force;
> -        this.grid.moveTo(bounds, force);
> +        if (this.layer.inRange && this.layer.visibility) {
> +            this.grid.moveTo(bounds, force);
> +        }
>      },
>
>      CLASS_NAME: "OpenLayers.Strategy.Grid"
> }}}
>
> But, it feels like we duplicate some code as the inRange and
> visibility checks are already made at the map level.
>
> Instead we could imagine adding a "moveend" event at the layer level.
> It would be triggered only when the layer is moved itself. And the
> strategies would register to this new event.
>
> Tshaub and sbenthall, please tell me if you feel confident with this.
> If so, I can commit something very quickly in the sandbox.
>
> Regards,
> Pierre
> _______________________________________________
> Dev mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to