[OpenLayers-Users] handle right mouse click
mario1982 at libero.it
mario1982 at libero.it
Thu Mar 11 14:37:06 EST 2010
Hi,
I've notice that the right mouse click remove the first line drown (not the last one) durning the polygon drawing. Instead the route drawing works fine.
Is it possible to do the same thing with polygons?
Regards,
Mario
>
> I have achieved this by changing the mousedown handler in Handler\Path.js
>
> mousedown: function(evt) {
> //PhilMaloney - Cancel drawing with right-click
> var rightclick;
> if (evt.which) rightclick = (evt.which == 3);
> else if (evt.button) rightclick = (evt.button == 2);
> if (rightclick) {
> var index = this.line.geometry.components.length - 1;
> this.line.geometry.removeComponent(this.line.geometry.components[index]);
> this.removePoint();
> this.finalize('cancel');
> return false;
> }
>
> // ignore double-clicks
> if (this.lastDown && this.lastDown.equals(evt.xy)) {
> return false;
> }
> if(this.lastDown == null) {
> if(this.persist) {
> this.destroyFeature();
> }
> this.createFeature(evt.xy);
> } else if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
> this.addPoint(evt.xy);
> }
> this.mouseDown = true;
> this.lastDown = evt.xy;
> this.drawing = true;
> return false;
> },
>
> Regards
> Phil
>
>
> mario1982 wrote:
> >
> > Hi,
> > I'm working on drawFeature.js and Path.js for drawing feature such as
> > lines and polygons. How can I handle right mouse click during the feature
> > drawing?
> > My goal is to find a way to undo the current feature by right mouse
> > clicking.
> >
> > Thank you for your help.
> > Regards,
> >
> > Mario
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
> >
> --
> View this message in context: http://n2.nabble.com/handle-right-mouse-click-tp4614676p4618395.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list