I'm making a slider widget with a <canvas>.
First I draw the background. I'd like to save this drawing. Something
like:
slider.drawBack ground();
slider.back = new ScreenArea( left, top, width, height );
Next, draw the pointer. When the user slides the slider, I'd like to
restore the saved background and then redraw the pointer. Any way of
doing this directly? Something like:
slider.back.res tore();
slider.drawPoin ter();
I've been playing with indirection: using context.toDataU RL() (after
drawing the background) but I haven't found a way to take that string
and use it to construct an Image object. What I want is:
slider.back = new Image( context.toDataU RL() ); // in my dreams!
Or maybe:
slider.back = new Image( wid, hgt );
slider.back.src = context.toDataU RL(); // still dreaming
First I draw the background. I'd like to save this drawing. Something
like:
slider.drawBack ground();
slider.back = new ScreenArea( left, top, width, height );
Next, draw the pointer. When the user slides the slider, I'd like to
restore the saved background and then redraw the pointer. Any way of
doing this directly? Something like:
slider.back.res tore();
slider.drawPoin ter();
I've been playing with indirection: using context.toDataU RL() (after
drawing the background) but I haven't found a way to take that string
and use it to construct an Image object. What I want is:
slider.back = new Image( context.toDataU RL() ); // in my dreams!
Or maybe:
slider.back = new Image( wid, hgt );
slider.back.src = context.toDataU RL(); // still dreaming
Comment