On BackgroundDoubleClicked, see if shift key press

Howdy – slapping my forehead on this one as I think it should be easy to figure out from the docs, but I am missing something.

I’m implementing the following behaviors :

1) if the background is double clicked (deteced w/a diagramListener on “BackgroundDoubleClicked”), zoom in (ala google maps).

Easy enough.

But, here’s where my problem is… I also want to do :

2) if the background is double clicked AND the SHIFT key is being depressed, call a zoom out. I thought I would have access to an e.key property on the diagramEvent object, but it turns out that is only available on a more specific kind of diagram event (InputEvent : http://gojs.net/beta/api/symbols/InputEvent.html).

Is there a better way to setup my listeners so that the key pressed during the BackgroundDoubleClicked event can be detected? Obviously, I could just drum up some jquery in parallel, but I’d rather keep the biz logic here all GoJS.

any help appreciated – thanks!

Greg

Yes, DiagramEvents are more abstract than InputEvents – some DiagramEvents do not even correspond to any InputEvent.

But in this case you could look at the e.diagram.lastInput.shift to see if the Shift key is being held down.

Aha! Awesome – thanks @walter, exactly what I was looking for…

Smile