- IAxis xAxis = getChart().getAxisSet().getXAxis(0);
- fBeginTime = limitXDataCoordinate(xAxis.getDataCoordinate(e.x));
- fEndTime = fBeginTime;
+ fDragBeginMarker = false;
+ if (((e.stateMask & SWT.SHIFT) != SWT.SHIFT) || (fEndTime == fBeginTime)) {
+ IAxis xAxis = getChart().getAxisSet().getXAxis(0);
+ fBeginTime = limitXDataCoordinate(xAxis.getDataCoordinate(e.x));
+ fEndTime = fBeginTime;
+ } else {
+ long selectionBegin = fBeginTime;
+ long selectionEnd = fEndTime;
+ IAxis xAxis = getChart().getAxisSet().getXAxis(0);
+ long time = limitXDataCoordinate(xAxis.getDataCoordinate(e.x));
+ if (Math.abs(time - selectionBegin) < Math.abs(time - selectionEnd)) {
+ fDragBeginMarker = true;
+ fBeginTime = time;
+ fEndTime = selectionEnd;
+ } else {
+ fBeginTime = selectionBegin;
+ fEndTime = time;
+ }
+ }