“Using SVG,” the awesome book…


… arrived today.

it is 800 effen pages long.

at last i now have a way to formally up my js/svg skills through intensive study.

Using SVG with CSS3 & HTML5of an extremely comprehensive book that has been written and peer revieed/proofed by multiple experts.

last night, i thought i had fixed all the little nits in XVG (except for that annoying shiver on each page reload) that came up when I introduced line drawing using code that looked like this

    svgRef.addEventListener(‘mousemove’, e => {
        if (drawing) {
                pt = svgRef.createSVGPoint();
                pt.x = e.clientX;
                pt.y = e.clientY;
                pt = pt.matrixTransform(svgRef.getScreenCTM().inverse());
                newLine.setAttribute(“x2”, pt.x);
                newLine.setAttribute(“y2”, pt.y);

unfortunately, this only introduced new problems that i had already solved with global flags and switches in the non dynamic line drawing portion of the code.

all these flags and switches are making my 1000 line baseline js program too hard to understand.

when I put the SVG line drawing through its paces, mixing fixed and dynamic line drawing at random, XVG quickly got confused.

i need some sort of event-driven architecture that captures all mouse events in the svg workspace or html body and funnels or routes them (to use a REACT term) to a canonical handler that correctly and predictably dispatches various events per some kind of predetermined state table.

this facility should also be able to handle unknow states in a graceful way without going kaboonkers.

come to think of it, I need to understand in precise terms exactly what is a JS event and if event event can be associated in some sort of token with their targets and current state such that event handler functions can evaluate this token prior to execution within their lexical scope.

XVG was working so nicely, i thought.

it was only after i introduced the complexity of dynamic element drawing that i realized how much I have left to learn.

so… time to hit the books then go back and rewrite XVG from the ground up.

see y’all back on the other side.