Modify

Opened 17 years ago

Closed 17 years ago

#112 closed enhancement (fixed)

Near-click plugin for "selecting things with tablet pen"

Reported by: josm@… Owned by: imi
Priority: major Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

For some highly irritating reason when using a tablet pc pen input, java doesn't register about three quarters of all screen taps as mouseClick events. This is actually because when using a waacom tablet the mouse press and mouse release are very rarely on the same pixel -- for Java this then doesn't constitute a click.

This makes basic editing a pain in the behind.

One solution (well, workaround really) is to process the mouse press and release events to check for "almost clicks".

In the JOSM code this can be done in the MapMode.java class:

	private int mouseDownX = -1;
        private int mouseDownY = -1;
        private long mouseDownTime = -1;

	public void mouseReleased(MouseEvent e) {
		if ( e.getButton() != MouseEvent.BUTTON1 )
			return;

		if ( e.getWhen() - mouseDownTime < 250 &&
			e.getPoint().x - mouseDownX < 7 &&
			e.getPoint().y - mouseDownY < 7 &&
			e.getPOint().x != mouseDownX &&
			e.getPoint().y != mouseDownY ) {
			mouseClicked(e);
		}
	}

	public void mousePressed(MouseEvent e) {
		if ( e.getButton() != MouseEvent.BUTTON1 )
			return;

		mouseDownX = e.getPoint().x;
		mouseDownY = e.getPoint().y;
                mouseDownTime = e.getWhen();
	}

This solution has been tested and works pretty well.

Attachments (0)

Change History (2)

comment:1 by imi, 17 years ago

Summary: Selecting things difficult with tablet penNear-click plugin for "selecting things with tablet pen"
Type: defectenhancement

This looks like a general problem with table pens and Java rather than a JOSM-specific.

So I'd rather see this as a plugin instead, as example by registering an global AWT-listener and firing an click-event when you "near-click" something.

Anyone up for such a plugin?

comment:2 by anonymous, 17 years ago

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain imi.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.