Using Javascript, how do I deactivate the drawing tool?
I have a control that activates the drawing tool in the "onFocus" event. I want to get to the selection tool when the user is done. Is that possible with Javascript / Events?
I have a control that activates the drawing tool in the "onFocus" event. I want to get to the selection tool when the user is done. Is that possible with Javascript / Events?
How would you enable the Hand tool via Javascript? It would have to be in an event listener. What event could you attach it to?
Yes, there is a way, but there are no events that will provide any kind of direct detection. Instead you have to go about it indirectly. There are two possible solutions.
1. Start an interval timer at the same time you start the drawing tool. Use the timer script to test for a new annotation on the page. Give the timer some maximum time as a safety. Maybe popup a message box to ask the user if they want to continue. I've used this method before and it works well as long as the users are well behaved.
2. Recreate the drawing tool in JS so you control it. This works well for circle and rectangle annots. What you do is create a page size invisible button. Use the button to detect mouse up and mouse down events. On mouse down create a circle or square annot at the mouse point. Start a timer to pick up the inbetween movements for drawing out the circle or square, then use Mouse up to kill the timer.
The #2 method is more reliable, but requires more coding on your part.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.