divyavamsee / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Allow event query after plotSymbolWasSelectedAtRecordIndex is called #388

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As an example, in my app, if the user clicks a plot, 
plotSymbolWasSelectedAtRecordIndex is called. However, when the user 
holds the shiftkey, I'd like to zoom in, not select. I solved this by 
calling [NSApp currentEvent] in plotSymbolWasSelectedAtRecordIndex to 
test for the modifier key, and process accordingly: 
-(void)scatterPlot:(CPTScatterPlot *)plot 
plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index 
{ 
    NSEvent *currentEvent = [NSApp currentEvent]; 
    if (!([currentEvent modifierFlags] & NSShiftKeyMask)) 
    { 
        self.selectedIndex = index; 
    } 
    else 
    { 
        zoomStart = [currentEvent locationInWindow]; 
        zoominProgress = YES; 
    } 
} 

It's a hack and it works, but I think it would be great if something 
similar were to built in into the framework. 

Original issue reported on code.google.com by koenvand...@gmail.com on 30 Dec 2011 at 2:22

GoogleCodeExporter commented 9 years ago

Original comment by eskr...@mac.com on 30 Dec 2011 at 3:44

GoogleCodeExporter commented 9 years ago
What is the preferred way to resolve this issue? I see at least three options:

1. Make new plot delegate methods similar to the existing ones that include the 
event as an additional parameter. The old delegate methods would continue to be 
supported for backwards compatibility.

2. Store the event in the graph (accessible via a property) before calling the 
-pointingDevice... methods on the plots, axis set, and plot spaces.

3. Store the event in the plot (accessible via a property) before calling the 
delegate.

My preference is option #1. Anyone else have an opinion?

Eric

Original comment by eskr...@mac.com on 22 Apr 2012 at 11:13

GoogleCodeExporter commented 9 years ago
I agree, passing the event with the delegate method seems the most logical.

Original comment by koenvand...@gmail.com on 23 Apr 2012 at 12:34

GoogleCodeExporter commented 9 years ago

Original comment by eskr...@mac.com on 28 Apr 2012 at 8:21

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 7888d057a237.

Original comment by eskr...@mac.com on 29 Apr 2012 at 1:53