public void mouseDragged() 
	{ 
		Object boundedObj = getTimeLineDrawObject(false);
		TimeLineDraw timeLineDraw = (boundedObj instanceof TimeLineDraw)?((TimeLineDraw)boundedObj):null;
		if (scrollBarDragOffset>-1) {
			int distDisplayed=timeLineObject.displayEnd - timeLineObject.displayStart;
			timeLineObject.displayStart=Math.round(((float)(mouseX-scrollBarDragOffset)/(float)screenWidth)*(float)timeLineObject.timeLineLength);
			if (timeLineObject.displayStart<0) {timeLineObject.displayStart=0;}
			timeLineObject.displayEnd=timeLineObject.displayStart+distDisplayed;
			if (timeLineObject.displayEnd>timeLineObject.timeLineLength) {
				timeLineObject.displayEnd=timeLineObject.timeLineLength;
				timeLineObject.displayStart=timeLineObject.displayEnd-distDisplayed;
			}
		} else if (buttonsDraw.inside(mouseX,mouseY)  ) {
			Object o=buttonsDraw.checkForObjectOnScreen(mouseX,mouseY);
			if ((o instanceof TimeLineObject) && (cueTimeLineObject == null)) {
				TimeLineObject tlo=(TimeLineObject)o;
				if (tlo!=null) {
					this.timeLineIndex=timeLines.indexOf(tlo);
					timeLines.removeElement(timeLineObject);
					timeLines.insertElementAt(timeLineObject,this.timeLineIndex);
				}
			}
		} 
		else if (timeLineDraw != null && timeLineDraw.inside(mouseX,mouseY)) {
			if (dragObject!=null && dragObject instanceof Event) {
				Event dragEvent = (Event) dragObject;
				if (!draggedFlag) {draggedFlag=true;saveUndo();}
				if (timeLineObject.selection.size()>0 && timeLineObject.selection.contains(dragObject)) {
					long draggedTime=getTimeFromMousePos();
					long oldDragEventTime=dragEvent.eventTime;
					long timeDiffDragged=draggedTime-oldDragEventTime;
					// get Max/Min event times.
					long min=timeLineObject.timeLineLength;
					long max=0;
					for (int i=0;i<timeLineObject.selection.size();i++) {
						Event e =(Event)timeLineObject.selection.get(i);
						if (e.eventTime>max) {max=e.eventTime;}
						if (e.eventTime<min) {min=e.eventTime;}
					}
					if (min+timeDiffDragged<0) {timeDiffDragged=-1*min;}
					if (max+timeDiffDragged>timeLineObject.timeLineLength) {timeDiffDragged=timeLineObject.timeLineLength-max;}
					for (int i=0;i<timeLineObject.selection.size();i++) {
						Event e=(Event)timeLineObject.selection.get(i);
						e.eventTime+=timeDiffDragged;
						// quantise if shift pressed.
						if (alt) {}
						else if (ctrl) {e.eventTime-=e.eventTime%(timeLineObject.quantize*timeLineObject.beatLength);}
						else {e.eventTime-=e.eventTime%timeLineObject.quantize;} 
					}
				} else {
					dragEvent.eventTime=getTimeFromMousePos();
					if (alt) {}
					else if (ctrl) {dragEvent.eventTime-=dragEvent.eventTime%(timeLineObject.quantize*timeLineObject.beatLength);}
					else {dragEvent.eventTime-=dragEvent.eventTime%timeLineObject.quantize;} 
				}
			} else if (dragObject!=null && dragObject instanceof String) {
				if ("posBar".equals(dragObject)) {
					timeLineObject.setPosAndNextEvent( getTimeFromMousePos());
				}
			} else {
				if (timeLineObject.timeSelStart>-1 && (timeLineDraw!=null &&  timeLineDraw.inside(mouseX,mouseY))) {
					timeLineObject.timeSelEnd=getTimeFromMousePos();
				}
			}
		}
		
		
	}