Only delay redrawing if the plotview has resized
This commit is contained in:
parent
3c52822637
commit
2d0555cf74
|
@ -5,6 +5,7 @@
|
|||
BOOL reallyDraw;
|
||||
BOOL isDragging;
|
||||
NSPoint dragStart;
|
||||
NSSize lastSize;
|
||||
}
|
||||
|
||||
-(void)setBrowser: (void*)aBrowser;
|
||||
|
|
|
@ -276,7 +276,9 @@ static const struct plotter_table gnustep_plotters = {
|
|||
*/
|
||||
-(void)drawRect: (NSRect)rect {
|
||||
NSLog(@"Drawing plotview");
|
||||
if (!reallyDraw) {
|
||||
BOOL sizeChanged = rect.size.width != lastSize.width ||
|
||||
rect.size.width != lastSize.width;
|
||||
if (!reallyDraw && sizeChanged) {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget: self];
|
||||
[self performSelector: @selector(reallyTriggerDraw) withObject: nil
|
||||
afterDelay: 0.01];
|
||||
|
@ -294,6 +296,7 @@ static const struct plotter_table gnustep_plotters = {
|
|||
.y1 = NSMaxY(rect)
|
||||
};
|
||||
browser_window_redraw(browser, 0, 0, &clip, &ctx);
|
||||
lastSize = rect.size;
|
||||
}
|
||||
|
||||
-(void)reallyTriggerDraw {
|
||||
|
|
Loading…
Reference in New Issue