CMS
The main shit, you know?
CanvasManager
This is the parent for the entire canvas environment.
Constructor
The constructor has a handful of required parameters:
bodyRef
- a reference to the DOM node that will house the canvasstory
width
and height
Event Handler
mousedown
canvas[this._listeners.mousedown] = function (e) {
e.stopPropagation();
e.preventDefault();
this._mousedown = true;
const coord = mouseCoord(e);
const child = this.tryMouseDown({ coord });
if (!child) return;
this._startCoord = coord;
this._currentChild = child;
if (!_.isFunction(this._currentChild.mousedown)) return;
this._currentChild.mousedown(coord);
};
Stepping through this one since it's a doozie.
stopPropagation
and preventDefault
shit.- Set tell
CanvasManager
the mouse is down. - Get the coordinate from the mouse.
- Try to hit a child (hah!) with the coordinate.
- If we don't hit a child (hahah!) die here.
- If we do, save our starting coordinate and save which child we hit (hahahah!)
- If the child doesn't have a valid mousedown function, die here.
- if it does, call it immediately.