The image map is a sequence of hot spots. ChartDirector will use the first hot spot that contains the mouse cursor (or a given x, y coordinates).
For example, consider the following code (it is in my response to one of your previous post):
std::string myImageMap = "<AREA ....."; //image map for DrawArea object 1
myImageMap += "<AREA ...."; // image map for DrawArea object 2 (if any)
myImageMap += c->getHTMLImageMap(.....); //image map for other chart objects
DrawArea object 1 will be tried first, followed by DrawArea object 2, followed by the hot spots generated by the chart for the chart objects.
If there are too many hot spots, it can be CPU intensive to try so many hot spots every time the mouse moves. (The mouse can trigger many mouse move events per second.) So in this case, ChartDirector will apply the following rule:
- If the mouse was inside a hot spot, and after the mouse move, it is inside the same hot spot, then it is considered to be inside the same hot spot (despite that it may have moved inside another overlapping hot spot too).
If you want to stop the last rule, you may add the following line in the MouseMovePlotArea event handler (add one if your code does not already have one):
// Search for an non-existent hot spot. ChartDirector will then consider the mouse
// is not on any hot spot, so the "same hot spot" rule will be apply.
ImageMapHandler *h = m_ChartViewer.getImageMapHandler();
if (0 != h) h->getHotSpot(-1, -1);
Are you referring to the SetCapture that we used internally inside the CChartViewer (in ChartViewer.cpp)?
I have attached a screen shot in which the drag rectangle starts from the CChartViewer and extends outside the CChartViewer. This is only possible if the mouse is captured by the CChartViewer, otherwise the CChartViewer cannot receive mouse events outside the CChartViewer, and it cannot know where the mouse has moved outside the CChartViewer.
Would you mind to try using the original ChartDirector sample code to see if it behaves similarly? Can you drag the zoom rectangle outside the CChartViewer?
I have also tried to modified the SetCapture() line inside CChartViewer.cpp to: