Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 408

Summary: [TF77016274] Fast Cursor for the Cursor tool. At the moment, the whole chart is r...
Product: HTML5 JavaScript TeeChart Reporter: yeray alonso <yeray>
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: major CC: david
Priority: Normal    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2013-11-20 11:59:32 EST
Fast Cursor for the Cursor tool.
At the moment, the whole chart is repainted each time the cursor tool is moved.
Theoricaly, html5 canvas suports xor:
https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html 
Tip: To make it work, it may be needed to call getContext each time the cursor is redrawn.
Customer interested: aldreen.sansone@iastech.com [created:2012-07-26T10:06:32.000+01:00 reported by:yeray@steema.com reported in version:]
Comment 1 david berneda 2013-11-25 10:17:13 EST
The problem with html5 blending (xor, etc) is that it only works in between getContext calls.

ie: As soon you finish drawing, and then moving the mouse, calling getContext again will enable xor blending but only for the items you draw with that context.
The previously painted chart contents are not used to do the blending.
Comment 2 christopher ireland 2013-11-25 10:30:30 EST
(In reply to david berneda from comment #1)
> The problem with html5 blending (xor, etc) is that it only works in between
> getContext calls.
> 
> ie: As soon you finish drawing, and then moving the mouse, calling
> getContext again will enable xor blending but only for the items you draw
> with that context.
> The previously painted chart contents are not used to do the blending.

If XOR cannot solve the problem of the whole chart being repainted on every mouse move, how about caching everything but the cursor tool as an image? That way redrawing will only have to paint the image and the cursor tool ...
Comment 3 david berneda 2013-11-25 15:37:13 EST
(In reply to chris ireland from comment #2)
> (In reply to david berneda from comment #1)
> > The problem with html5 blending (xor, etc) is that it only works in between
> > getContext calls.
> > 
> > ie: As soon you finish drawing, and then moving the mouse, calling
> > getContext again will enable xor blending but only for the items you draw
> > with that context.
> > The previously painted chart contents are not used to do the blending.
> 
> If XOR cannot solve the problem of the whole chart being repainted on every
> mouse move, how about caching everything but the cursor tool as an image?
> That way redrawing will only have to paint the image and the cursor tool ...

Yes this is already supported with cursor's "render" property:

http://www.steema.com/files/public/teechart/html5/v2012.12.14.1.4/demos/extra/CursorTool.htm

"Keep a copy" does caching, and "Layer on top" uses a layer (another canvas) on top, with transparent background (similar to xor support in vcl gdi+)

Speed depends on browser, chart size etc. Layer style likely shows some lag/tearing.
Comment 4 christopher ireland 2013-11-25 15:47:46 EST
> Yes this is already supported with cursor's "render" property:
> 
> http://www.steema.com/files/public/teechart/html5/v2012.12.14.1.4/demos/
> extra/CursorTool.htm
> 
> "Keep a copy" does caching, and "Layer on top" uses a layer (another canvas)
> on top, with transparent background (similar to xor support in vcl gdi+)
> 
> Speed depends on browser, chart size etc. Layer style likely shows some
> lag/tearing.

Excellent, then this may just be the answer to the client's original question of how to avoid painting the entire chart on every cursor movement.