void mousePressed() { if (currentLarge != null) { if (parent.mouseEvent.getClickCount() == 2) { // shrink it back down! // generate thumbnail currentLarge.setSize((int) (smallVizSize.x), (int) (smallVizSize.y)); moveToPosition(currentLarge); currentLarge .checkComponents(); // work out if we've double-clicked on the map, the cloud or the // streamgraph! currentLarge.currentTransitionState = MovementState.SHRINKING; currentLarge = null; } else { currentLarge.mousePressed(); } } else { for (TwitterFilteringComponent a : timePoints) { if (parent.mouseEvent.getClickCount() == 2 && a.hasMouseOver()) { PApplet.println("<double click> on " + a); previousPos = new PVector(a.x, a.y); a.moveTo(0, 0); a.setSize(width, height); currentLarge = a; a.currentTransitionState = MovementState.GROWING; break; } else if (a.hasMouseOver() && parent.keyPressed && parent.keyCode == PConstants.SHIFT) { // move middle to where the mouse is? PApplet.println("Dragging start" + a); currentDragging = a; draggingOffsetX = parent.mouseX - a.x; draggingOffsetY = parent.mouseY - a.y; currentDragging.currentTransitionState = MovementState.MOVING; // a.mousePressed(); } if (parent.mouseButton == PConstants.RIGHT) { // aha! we're doing captioning! if (a.hasMouseOver() && !a.hasCaption()) { a.addCaption(); } else if (a.hasCaption() && a.caption.mouseOver()) { PApplet.println("We want to edit the caption!"); a.caption.createNote(); } } } } }
void mouseReleased() { if (currentDragging != null) { currentDragging.currentTransitionState = MovementState.SMALL; currentDragging = null; PApplet.println("Stopped dragging"); } for (TwitterFilteringComponent a : timePoints) { if (a.hasMouseOver()) { a.mouseReleased(); } } }