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

signature-mark

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

signature-mark - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

49

build/signature-mark.js

@@ -1,2 +0,2 @@

/*! signature-mark.js - 0.0.1 - 2014-10-12 - motdotla */
/*! signature-mark.js - 0.0.1 - 2016-10-01 - motdotla */
(function(exports){

@@ -25,12 +25,47 @@ var SignatureMark = function(canvas) {

(function(SignatureMark){
SignatureMark.prototype.initEvents = function() {
var listeners = {};
SignatureMark.prototype.initEvents = function () {
var self = this;
self.canvas.addEventListener(self.mouse_down, function(e) { self.onCanvasMouseDown(self, e); }, false);
self.canvas.addEventListener(self.mouse_move, function(e) { self.onCanvasMouseMove(self, e); }, false);
self.canvas.addEventListener('contextmenu', function(e) { self.preventRightClick(self, e); }, false);
listeners = {
canvas: {},
document: {}
};
listeners.canvas[self.mouse_down] = function (e) {
self.onCanvasMouseDown(self, e);
};
listeners.canvas[self.mouse_move] = function (e) {
self.onCanvasMouseMove(self, e);
};
listeners.canvas.contextmenu = function (e) {
self.preventRightClick(self, e);
};
listeners.canvas[self.mouse_up] = function (e) {
self.onCanvasMouseUp(self, e);
};
listeners.document[self.mouse_up] = function (e) {
self.onCanvasMouseUp(self, e);
};
document.addEventListener(self.mouse_up, function(e) { self.onCanvasMouseUp(self, e); }, false);
self.canvas.addEventListener(self.mouse_up, function(e) { self.onCanvasMouseUp(self, e); }, false);
for (var canvasEvent in listeners.canvas) {
self.canvas.addEventListener(canvasEvent, listeners.canvas[canvasEvent], false);
}
for (var documentEvent in listeners.document) {
document.addEventListener(documentEvent, listeners.document[documentEvent], false);
}
};
SignatureMark.prototype.destroy = function() {
if (self.canvas) {
for (var canvasEvent in listeners.canvas) {
self.canvas.removeEventListener(canvasEvent, listeners.canvas[canvasEvent]);
}
}
for (var documentEvent in listeners.canvas) {
document.removeEventListener(documentEvent, listeners.document[documentEvent]);
}
};
SignatureMark.prototype.preventRightClick = function(self, e) {

@@ -37,0 +72,0 @@ e.preventDefault();

4

build/signature-mark.min.js

@@ -1,2 +0,2 @@

/*! signature-mark.js - 0.0.1 - 2014-10-12 - motdotla */
!function(a){var b=function(a){return this instanceof b?(this.canvas=a,this.init(),this):new b(a)};b.prototype.init=function(){this.initVariables(),this.initPainters(),this.initEvents()},a.SignatureMark=b}(this),function(a){a.prototype.initEvents=function(){var a=this;a.canvas.addEventListener(a.mouse_down,function(b){a.onCanvasMouseDown(a,b)},!1),a.canvas.addEventListener(a.mouse_move,function(b){a.onCanvasMouseMove(a,b)},!1),a.canvas.addEventListener("contextmenu",function(b){a.preventRightClick(a,b)},!1),document.addEventListener(a.mouse_up,function(b){a.onCanvasMouseUp(a,b)},!1),a.canvas.addEventListener(a.mouse_up,function(b){a.onCanvasMouseUp(a,b)},!1)},a.prototype.preventRightClick=function(a,b){b.preventDefault()},a.prototype.onCanvasMouseDown=function(a,b){b.preventDefault(),a.setCanvasOffset(a),a.startDrawingStroke(a),a.setMouseXAndMouseY(a,b),a.setPainters(a)},a.prototype.onCanvasMouseMove=function(a,b){b.preventDefault(),a.setMouseXAndMouseY(a,b)},a.prototype.onCanvasMouseUp=function(a){a.stopDrawingStroke(a)},a.prototype.setMouseXAndMouseY=function(a,b){a.touch_supported?(target=b.touches[0],a.mouseX=target.pageX-a.canvasOffsetLeft,a.mouseY=target.pageY-a.canvasOffsetTop):(a.mouseX=b.pageX-a.canvasOffsetLeft,a.mouseY=b.pageY-a.canvasOffsetTop)},a.prototype.setCanvasOffset=function(a){canvasOffset=a.Offset(a.canvas),a.canvasOffsetLeft=canvasOffset.left,a.canvasOffsetTop=canvasOffset.top}}(SignatureMark),function(a){a.prototype.Offset=function(a){if(void 0===a)return null;var b=a.getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset}}}(SignatureMark),function(a){a.prototype.initPainters=function(){this.painters=[];for(var a=0;a<this.max_strokes;a++){var b=.05*Math.random()+this.easing;this.painters.push({dx:0,dy:0,ax:0,ay:0,div:.1,ease:b})}},a.prototype.setPainters=function(a){for(var b=0;b<a.painters.length;b++)pntr=a.painters[b],pntr.dx=a.mouseX,pntr.dy=a.mouseY}}(SignatureMark),function(a){a.prototype.drawStroke=function(a){var b;for(b=0;b<a.painters.length;b++){a.context.beginPath(),pntr=a.painters[b],a.context.moveTo(pntr.dx,pntr.dy);var c=pntr.ax=(pntr.ax+(pntr.dx-a.mouseX)*pntr.div)*pntr.ease;pntr.dx-=c;var d=pntr.dx,e=pntr.ay=(pntr.ay+(pntr.dy-a.mouseY)*pntr.div)*pntr.ease;pntr.dy-=e;var f=pntr.dy;a.context.lineTo(d,f),a.context.stroke()}},a.prototype.startDrawingStroke=function(a){var b=setInterval(function(){a.drawStroke(a)},a.refresh_rate);a.strokeIntervals.push(b)},a.prototype.stopDrawingStroke=function(a){for(var b=0;b<a.strokeIntervals.length;b++)clearInterval(a.strokeIntervals[b])}}(SignatureMark),function(a){a.prototype.initVariables=function(){this.touch_supported="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch?!0:!1,this.context=this.canvas.getContext("2d"),this.color=[0,0,0],this.brush_pressure=.5,this.context.strokeStyle="rgba("+this.color[0]+", "+this.color[1]+", "+this.color[2]+", "+this.brush_pressure+")",this.context.lineWidth=2.5,this.painters=[],this.mouseX=0,this.mouseY=0,this.strokeIntervals=[],this.refresh_rate=5,this.max_strokes=12,this.easing=.7,this.mouse_down="mousedown",this.mouse_move="mousemove",this.mouse_up="mouseup",this.touch_supported?(this.mouse_down="touchstart",this.mouse_move="touchmove",this.mouse_up="touchend"):(this.refresh_rate=10,this.max_strokes=100)}}(SignatureMark);
/*! signature-mark.js - 0.0.1 - 2016-10-01 - motdotla */
!function(a){var b=function(a){return this instanceof b?(this.canvas=a,this.init(),this):new b(a)};b.prototype.init=function(){this.initVariables(),this.initPainters(),this.initEvents()},a.SignatureMark=b}(this),function(a){var b={};a.prototype.initEvents=function(){var a=this;b={canvas:{},document:{}},b.canvas[a.mouse_down]=function(b){a.onCanvasMouseDown(a,b)},b.canvas[a.mouse_move]=function(b){a.onCanvasMouseMove(a,b)},b.canvas.contextmenu=function(b){a.preventRightClick(a,b)},b.canvas[a.mouse_up]=function(b){a.onCanvasMouseUp(a,b)},b.document[a.mouse_up]=function(b){a.onCanvasMouseUp(a,b)};for(var c in b.canvas)a.canvas.addEventListener(c,b.canvas[c],!1);for(var d in b.document)document.addEventListener(d,b.document[d],!1)},a.prototype.destroy=function(){if(self.canvas)for(var a in b.canvas)self.canvas.removeEventListener(a,b.canvas[a]);for(var c in b.canvas)document.removeEventListener(c,b.document[c])},a.prototype.preventRightClick=function(a,b){b.preventDefault()},a.prototype.onCanvasMouseDown=function(a,b){b.preventDefault(),a.setCanvasOffset(a),a.startDrawingStroke(a),a.setMouseXAndMouseY(a,b),a.setPainters(a)},a.prototype.onCanvasMouseMove=function(a,b){b.preventDefault(),a.setMouseXAndMouseY(a,b)},a.prototype.onCanvasMouseUp=function(a,b){a.stopDrawingStroke(a)},a.prototype.setMouseXAndMouseY=function(a,b){a.touch_supported?(target=b.touches[0],a.mouseX=target.pageX-a.canvasOffsetLeft,a.mouseY=target.pageY-a.canvasOffsetTop):(a.mouseX=b.pageX-a.canvasOffsetLeft,a.mouseY=b.pageY-a.canvasOffsetTop)},a.prototype.setCanvasOffset=function(a){canvasOffset=a.Offset(a.canvas),a.canvasOffsetLeft=canvasOffset.left,a.canvasOffsetTop=canvasOffset.top}}(SignatureMark),function(a){a.prototype.Offset=function(a){if(void 0===a)return null;var b=a.getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset}}}(SignatureMark),function(a){a.prototype.initPainters=function(){this.painters=[];for(var a=0;a<this.max_strokes;a++){var b=.05*Math.random()+this.easing;this.painters.push({dx:0,dy:0,ax:0,ay:0,div:.1,ease:b})}},a.prototype.setPainters=function(a){for(var b=0;b<a.painters.length;b++)pntr=a.painters[b],pntr.dx=a.mouseX,pntr.dy=a.mouseY}}(SignatureMark),function(a){a.prototype.drawStroke=function(a){var b;for(b=0;b<a.painters.length;b++){a.context.beginPath(),pntr=a.painters[b],a.context.moveTo(pntr.dx,pntr.dy);var c=pntr.ax=(pntr.ax+(pntr.dx-a.mouseX)*pntr.div)*pntr.ease;pntr.dx-=c;var d=pntr.dx,e=pntr.ay=(pntr.ay+(pntr.dy-a.mouseY)*pntr.div)*pntr.ease;pntr.dy-=e;var f=pntr.dy;a.context.lineTo(d,f),a.context.stroke()}},a.prototype.startDrawingStroke=function(a){var b=setInterval(function(){a.drawStroke(a)},a.refresh_rate);a.strokeIntervals.push(b)},a.prototype.stopDrawingStroke=function(a){for(var b=0;b<a.strokeIntervals.length;b++)clearInterval(a.strokeIntervals[b])}}(SignatureMark),function(a){a.prototype.initVariables=function(){this.touch_supported="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch?!0:!1,this.context=this.canvas.getContext("2d"),this.color=[0,0,0],this.brush_pressure=.5,this.context.strokeStyle="rgba("+this.color[0]+", "+this.color[1]+", "+this.color[2]+", "+this.brush_pressure+")",this.context.lineWidth=2.5,this.painters=[],this.mouseX=0,this.mouseY=0,this.strokeIntervals=[],this.refresh_rate=5,this.max_strokes=12,this.easing=.7,this.mouse_down="mousedown",this.mouse_move="mousemove",this.mouse_up="mouseup",this.touch_supported?(this.mouse_down="touchstart",this.mouse_move="touchmove",this.mouse_up="touchend"):(this.refresh_rate=10,this.max_strokes=100)}}(SignatureMark);
{
"name": "signature-mark",
"version": "0.0.1",
"version": "0.0.2",
"author": "motdotla",

@@ -5,0 +5,0 @@ "devDependencies": {

(function(SignatureMark){
SignatureMark.prototype.initEvents = function() {
var listeners = {};
SignatureMark.prototype.initEvents = function () {
var self = this;
self.canvas.addEventListener(self.mouse_down, function(e) { self.onCanvasMouseDown(self, e); }, false);
self.canvas.addEventListener(self.mouse_move, function(e) { self.onCanvasMouseMove(self, e); }, false);
self.canvas.addEventListener('contextmenu', function(e) { self.preventRightClick(self, e); }, false);
listeners = {
canvas: {},
document: {}
};
listeners.canvas[self.mouse_down] = function (e) {
self.onCanvasMouseDown(self, e);
};
listeners.canvas[self.mouse_move] = function (e) {
self.onCanvasMouseMove(self, e);
};
listeners.canvas.contextmenu = function (e) {
self.preventRightClick(self, e);
};
listeners.canvas[self.mouse_up] = function (e) {
self.onCanvasMouseUp(self, e);
};
listeners.document[self.mouse_up] = function (e) {
self.onCanvasMouseUp(self, e);
};
document.addEventListener(self.mouse_up, function(e) { self.onCanvasMouseUp(self, e); }, false);
self.canvas.addEventListener(self.mouse_up, function(e) { self.onCanvasMouseUp(self, e); }, false);
for (var canvasEvent in listeners.canvas) {
self.canvas.addEventListener(canvasEvent, listeners.canvas[canvasEvent], false);
}
for (var documentEvent in listeners.document) {
document.addEventListener(documentEvent, listeners.document[documentEvent], false);
}
};
SignatureMark.prototype.destroy = function() {
if (self.canvas) {
for (var canvasEvent in listeners.canvas) {
self.canvas.removeEventListener(canvasEvent, listeners.canvas[canvasEvent]);
}
}
for (var documentEvent in listeners.canvas) {
document.removeEventListener(documentEvent, listeners.document[documentEvent]);
}
};
SignatureMark.prototype.preventRightClick = function(self, e) {

@@ -13,0 +48,0 @@ e.preventDefault();

Sorry, the diff of this file is not supported yet

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