Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

andys-canvys

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

andys-canvys

A canvas library from your old pal andy.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

Keywords

FAQs

Package last updated on 28 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc