Esempio n. 1
0
void ofxTLZoomer::mouseDragged(ofMouseEventArgs& args) {
	if(!enabled) return;

	ofRange oldRange = currentViewRange;
	if(minSelected || midSelected){
		currentViewRange.min = ofClamp( screenXtoNormalizedX(args.x-minGrabOffset), 0, currentViewRange.max);
		notifyZoomDragged(oldRange);
	}

	if(maxSelected || midSelected){
		currentViewRange.max = ofClamp( screenXtoNormalizedX(args.x-maxGrabOffset), currentViewRange.min, 1.0);
		notifyZoomDragged(oldRange);
	}	
}
Esempio n. 2
0
void ofxTLZoomer::mouseDragged(ofMouseEventArgs& args) {
    
	if(!enabled) return;
	
    bool notify = false;
	ofRange oldRange = getViewRange();
	if(minSelected || midSelected){
		float originalMin = currentViewRange.min;
		currentViewRange.min = ofClamp( screenXtoNormalizedX(args.x-minGrabOffset, ofRange(0, 1.0)), 0, currentViewRange.max-.01);
		if(minSelected){
			currentViewRange.max = ofClamp( currentViewRange.max + (originalMin-currentViewRange.min), currentViewRange.min+.01, 1.0);
		}
		notify = true;
	}

	if(maxSelected || midSelected){
		float originalMax = currentViewRange.max;
		currentViewRange.max = ofClamp( screenXtoNormalizedX(args.x-maxGrabOffset, ofRange(0, 1.0)), currentViewRange.min+.01, 1.0);
		if(maxSelected){
			currentViewRange.min = ofClamp( currentViewRange.min + (originalMax-currentViewRange.max), 0, currentViewRange.max-.01);
		}
        notify = true;
    }
	
    if(notify){
        notifyZoomDragged(oldRange);
    }
}