|
How invoke overlapped imageMap |
Posted by Thexder ho on Apr-14-2022 12:17 |
|
Hi Peter,
I have a problem with overlapping imageMap,
How to set the image map priority when two image hotpots were overlapped?
I tried to use "!" embedding the map to set the importancy, however it seems no help.
any idea?
Best Rgds
Thexder |
Re: How invoke overlapped imageMap |
Posted by Peter Kwan on Apr-15-2022 16:37 |
|
Hi Thexder,
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);
Best Regards
Peter Kwan |
Re: How invoke overlapped imageMap |
Posted by Thexder ho on Apr-16-2022 09:46 |
|
Hi Peter,
already figured the way how to handle the image overlapping problem, anyway thanks for your help as always,
btw, I found that SetCapture() is not working properly in OnLButtonDown()
the GetCapture() always return NULL, just trying to find out the reason, I'm still trying to trace out this.
do you have any idea on this?
B.R.
Thexder |
Re: How invoke overlapped imageMap |
Posted by Peter Kwan on Apr-16-2022 13:05 |
|
Hi Thexder,
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:
CWnd *v0 = GetCapture();
SetCapture();
CWnd *v1 = GetCapture();
I found that v0 is null, while v1 is not null. This confirms SetCapture works in my machine.
Regards
Peter Kwan
|
Re: How invoke overlapped imageMap |
Posted by Thexder ho on Apr-18-2022 16:11 |
|
Thank you Peter,
it's fine now, it's the compiler problem, after encoding the new code but my compiler still compiling on the old buffer memory.
Sorry for this issue.
B.R.
Thexder |
|