From 2c6c704e9633f7e92c9299e7150f209cb1055cd1 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Fri, 14 Dec 2012 15:45:25 +0000 Subject: Don't grab the tool except on clicks --- tikzit/src/gtk/GraphEditorPanel.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tikzit/src/gtk/GraphEditorPanel.m b/tikzit/src/gtk/GraphEditorPanel.m index d2a1831..4c7312a 100644 --- a/tikzit/src/gtk/GraphEditorPanel.m +++ b/tikzit/src/gtk/GraphEditorPanel.m @@ -93,6 +93,10 @@ } } +- (BOOL) hasTool { + return [tool activeRenderer] == renderer; +} + - (void) grabTool { if ([tool activeRenderer] != renderer) { [[tool activeRenderer] setPostRenderer:nil]; @@ -141,7 +145,8 @@ } - (void) mouseReleaseAt:(NSPoint)pos withButton:(MouseButton)button andMask:(InputMask)mask { - [panel grabTool]; + if (![panel hasTool]) + return; id tool = [panel activeTool]; if ([tool respondsToSelector:@selector(mouseReleaseAt:withButton:andMask:)]) { [tool mouseReleaseAt:pos withButton:button andMask:mask]; @@ -149,7 +154,8 @@ } - (void) mouseMoveTo:(NSPoint)pos withButtons:(MouseButton)buttons andMask:(InputMask)mask { - [panel grabTool]; + if (![panel hasTool]) + return; id tool = [panel activeTool]; if ([tool respondsToSelector:@selector(mouseMoveTo:withButtons:andMask:)]) { [tool mouseMoveTo:pos withButtons:buttons andMask:mask]; @@ -157,7 +163,6 @@ } - (void) mouseScrolledAt:(NSPoint)pos inDirection:(ScrollDirection)dir withMask:(InputMask)mask { - [panel grabTool]; id tool = [panel activeTool]; if (mask == ControlMask) { if (dir == ScrollUp) { @@ -165,7 +170,7 @@ } else if (dir == ScrollDown) { [panel zoomOutAboutPoint:pos]; } - } else if ([tool respondsToSelector:@selector(mouseScrolledAt:inDirection:withMask:)]) { + } else if ([panel hasTool] && [tool respondsToSelector:@selector(mouseScrolledAt:inDirection:withMask:)]) { [tool mouseScrolledAt:pos inDirection:dir withMask:mask]; } } -- cgit v1.2.3