1.0.3 • Published 5 years ago

andys-canvys v1.0.3

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

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: 1. bodyRef - a reference to the DOM node that will house the canvas 2. story 3. width and height

Event Handler

mousedown
canvas[this._listeners.mousedown] = function (e) {
	e.stopPropagation();
	e.preventDefault(); // 1.

	this._mousedown = true; // 2.

	const coord = mouseCoord(e); // 3.

	const child = this.tryMouseDown({ coord }); // 4.
	if (!child) return; // 5.

	this._startCoord = coord;
	this._currentChild = child; // 6.

	if (!_.isFunction(this._currentChild.mousedown)) return; // 7.

	this._currentChild.mousedown(coord); // 8.
};

Stepping through this one since it's a doozie. 1. stopPropagation and preventDefault shit. 2. Set tell CanvasManager the mouse is down. 3. Get the coordinate from the mouse. 4. Try to hit a child (hah!) with the coordinate. 5. If we don't hit a child (hahah!) die here. 6. If we do, save our starting coordinate and save which child we hit (hahahah!) 7. If the child doesn't have a valid mousedown function, die here. 8. if it does, call it immediately.

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago