Thank you Andreas for clearing up that I should assign events like so:
events = map.events
The other part of this is that you have specify that the event you are
triggering is a left-click.
By tracing the code you see that you need to set the "which" attribute to 1 in
the object passed to triggerEvent(), otherwise onClick in featureclick.js
ignores the event.
So, this is what my code should have looked like:
events = map.events;
events.triggerEvent( 'mousedown', {xy: new OpenLayers.Pixel(0,0), which: 1},
map);
events.triggerEvent('mouseup', {xy: new OpenLayers.Pixel(0,0), which: 1}, map);
I'm assuming I can get tests written today. Although, I'm not exactly clear how
to submit them. If anyone wants to clue me in to that procedure I'd appreciate
it.
-Mike
On May 21, 2013, at 5:21 PM, Michael Ryan <[email protected]> wrote:
> While I've understood I need to use trigger() somehow, I have been
> unsuccessful in implementing it.
>
> I was using test for buttonclick as a reference:
> https://github.com/openlayers/openlayers/blob/master/tests/Events/buttonclick.html
>
> I would have assumed that within the context of the featurclick example
> https://github.com/openlayers/openlayers/pull/174/files
>
> I could have used something like
>
> events = OpenLayers.Events(map, document.getElementById("map"));
> events.triggerEvent({type: 'mousedown', xy: new OpenLayers.Pixel(0,0)}, map);
> events.triggerEvent({type: 'mouseup', xy: new OpenLayers.Pixel(0,0)}, map);
>
> But, apparently, that's wrong.
>
> Am I trying to do something that isn't possible? I'm assuming I'm just
> implementing it wrong. Any thoughts?
>
> -Mike
>
> On May 20, 2013, at 5:04 PM, Michael Ryan <[email protected]> wrote:
>
>> I'll answer my question about triggering a buttonclick by saying, it looks
>> like you use trigger() which takes coordinates as an argument as in this
>> test:
>> https://github.com/drewwells/openlayers/blob/master/tests/Control/Measure.html
>
_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev