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

dom-2d-camera

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-2d-camera - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## v1.0.2
- Fix incorrect default parameters for `viewCenter` and `scaleBounds`
## v1.0.1

@@ -2,0 +6,0 @@

4

dist/dom-2d-camera.esm.js

@@ -18,4 +18,4 @@ import createCamera from 'camera-2d-simple';

zoomSpeed = 1,
viewCenter = null,
scaleBounds = null,
viewCenter,
scaleBounds,
onKeyDown = () => {},

@@ -22,0 +22,0 @@ onKeyUp = () => {},

@@ -25,4 +25,4 @@ (function (global, factory) {

var zoomSpeed = ref.zoomSpeed; if ( zoomSpeed === void 0 ) zoomSpeed = 1;
var viewCenter = ref.viewCenter; if ( viewCenter === void 0 ) viewCenter = null;
var scaleBounds = ref.scaleBounds; if ( scaleBounds === void 0 ) scaleBounds = null;
var viewCenter = ref.viewCenter;
var scaleBounds = ref.scaleBounds;
var onKeyDown = ref.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = function () {};

@@ -29,0 +29,0 @@ var onKeyUp = ref.onKeyUp; if ( onKeyUp === void 0 ) onKeyUp = function () {};

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("camera-2d-simple"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["camera-2d-simple","gl-matrix"],n):(e=e||self).createDom2dCamera=n(e.createCamera2d,e.glMatrix)}(this,(function(e,n){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;return function(o,i){void 0===i&&(i={});var t=i.distance;void 0===t&&(t=1);var r=i.target;void 0===r&&(r=[0,0]);var v=i.rotation;void 0===v&&(v=0);var d=i.isNdc;void 0===d&&(d=!0);var a=i.isFixed;void 0===a&&(a=!1);var u=i.isPan;void 0===u&&(u=!0);var s=i.panSpeed;void 0===s&&(s=1);var l=i.isRotate;void 0===l&&(l=!0);var f=i.rotateSpeed;void 0===f&&(f=1);var c=i.isZoom;void 0===c&&(c=!0);var p=i.zoomSpeed;void 0===p&&(p=1);var m=i.viewCenter;void 0===m&&(m=null);var w=i.scaleBounds;void 0===w&&(w=null);var E=i.onKeyDown;void 0===E&&(E=function(){});var L=i.onKeyUp;void 0===L&&(L=function(){});var h=i.onMouseDown;void 0===h&&(h=function(){});var y=i.onMouseUp;void 0===y&&(y=function(){});var g=i.onMouseMove;void 0===g&&(g=function(){});var x=i.onWheel;void 0===x&&(x=function(){});var M=e(r,t,v,m,w),S=!1,k=0,C=0,D=0,K=0,P=!1,R=0,b=0,q=0,z=1,B=1,F=1,U=!1,Y=d?function(e){return e/z*2*F}:function(e){return e},Z=d?function(e){return e/B*2}:function(e){return-e},j=d?function(e){return(e/z*2-1)*F}:function(e){return e},N=d?function(e){return 1-e/B*2}:function(e){return e},O=function(){var e=o.getBoundingClientRect();b=e.top,q=e.left,z=e.width,B=e.height,F=z/B},W=function(e){U=!1,L(e)},X=function(e){U=e.altKey,E(e)},A=function(e){P=!1,y(e)},G=function(e){P=1===e.buttons,h(e)},H=function(e){D=k,K=C,k=e.clientX-q,C=e.clientY-b,g(e)},I=function(e){e.preventDefault();var n=1===e.deltaMode?12:1;R+=n*(e.deltaY||0),x(e)};return window.addEventListener("keydown",X,{passive:!0}),window.addEventListener("keyup",W,{passive:!0}),o.addEventListener("mousedown",G,{passive:!0}),window.addEventListener("mouseup",A,{passive:!0}),window.addEventListener("mousemove",H,{passive:!0}),o.addEventListener("wheel",I,{passive:!1}),O(),M.config=function(e){void 0===e&&(e={});var n=e.isFixed;void 0===n&&(n=null);var o=e.isPan;void 0===o&&(o=null);var i=e.isRotate;void 0===i&&(i=null);var t=e.isZoom;void 0===t&&(t=null);var r=e.panSpeed;void 0===r&&(r=null);var v=e.rotateSpeed;void 0===v&&(v=null);var d=e.zoomSpeed;void 0===d&&(d=null),a=null!==n?n:a,u=null!==o?o:u,l=null!==i?i:l,c=null!==t?t:c,s=+r>0?r:s,f=+v>0?v:f,p=+d>0?d:p},M.dispose=function(){M=void 0,window.removeEventListener("keydown",X),window.removeEventListener("keyup",W),o.removeEventListener("mousedown",G),window.removeEventListener("mouseup",A),window.removeEventListener("mousemove",H),o.removeEventListener("wheel",I)},M.refresh=O,M.tick=function(){if(a)return!1;if(S=!1,u&&P&&!U&&(M.pan([Y(s*(k-D)),Z(s*(K-C))]),S=!0),c&&R){var e=p*Math.exp(R/B),o=j(k),i=N(C);M.scale(1/e,[o,i]),S=!0}if(l&&P&&U){var t=z/2,r=B/2,v=D-t,d=r-K,m=k-t,w=r-C,E=n.vec2.angle([v,d],[m,w]),L=v*w-m*d;M.rotate(f*E*Math.sign(L)),S=!0}return R=0,D=k,K=C,S},M}}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("camera-2d-simple"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["camera-2d-simple","gl-matrix"],n):(e=e||self).createDom2dCamera=n(e.createCamera2d,e.glMatrix)}(this,(function(e,n){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;return function(o,i){void 0===i&&(i={});var t=i.distance;void 0===t&&(t=1);var r=i.target;void 0===r&&(r=[0,0]);var v=i.rotation;void 0===v&&(v=0);var d=i.isNdc;void 0===d&&(d=!0);var a=i.isFixed;void 0===a&&(a=!1);var u=i.isPan;void 0===u&&(u=!0);var s=i.panSpeed;void 0===s&&(s=1);var l=i.isRotate;void 0===l&&(l=!0);var f=i.rotateSpeed;void 0===f&&(f=1);var c=i.isZoom;void 0===c&&(c=!0);var p=i.zoomSpeed;void 0===p&&(p=1);var m=i.viewCenter,w=i.scaleBounds,E=i.onKeyDown;void 0===E&&(E=function(){});var L=i.onKeyUp;void 0===L&&(L=function(){});var h=i.onMouseDown;void 0===h&&(h=function(){});var y=i.onMouseUp;void 0===y&&(y=function(){});var g=i.onMouseMove;void 0===g&&(g=function(){});var x=i.onWheel;void 0===x&&(x=function(){});var M=e(r,t,v,m,w),S=!1,k=0,C=0,D=0,K=0,P=!1,R=0,b=0,q=0,z=1,B=1,F=1,U=!1,Y=d?function(e){return e/z*2*F}:function(e){return e},Z=d?function(e){return e/B*2}:function(e){return-e},j=d?function(e){return(e/z*2-1)*F}:function(e){return e},N=d?function(e){return 1-e/B*2}:function(e){return e},O=function(){var e=o.getBoundingClientRect();b=e.top,q=e.left,z=e.width,B=e.height,F=z/B},W=function(e){U=!1,L(e)},X=function(e){U=e.altKey,E(e)},A=function(e){P=!1,y(e)},G=function(e){P=1===e.buttons,h(e)},H=function(e){D=k,K=C,k=e.clientX-q,C=e.clientY-b,g(e)},I=function(e){e.preventDefault();var n=1===e.deltaMode?12:1;R+=n*(e.deltaY||0),x(e)};return window.addEventListener("keydown",X,{passive:!0}),window.addEventListener("keyup",W,{passive:!0}),o.addEventListener("mousedown",G,{passive:!0}),window.addEventListener("mouseup",A,{passive:!0}),window.addEventListener("mousemove",H,{passive:!0}),o.addEventListener("wheel",I,{passive:!1}),O(),M.config=function(e){void 0===e&&(e={});var n=e.isFixed;void 0===n&&(n=null);var o=e.isPan;void 0===o&&(o=null);var i=e.isRotate;void 0===i&&(i=null);var t=e.isZoom;void 0===t&&(t=null);var r=e.panSpeed;void 0===r&&(r=null);var v=e.rotateSpeed;void 0===v&&(v=null);var d=e.zoomSpeed;void 0===d&&(d=null),a=null!==n?n:a,u=null!==o?o:u,l=null!==i?i:l,c=null!==t?t:c,s=+r>0?r:s,f=+v>0?v:f,p=+d>0?d:p},M.dispose=function(){M=void 0,window.removeEventListener("keydown",X),window.removeEventListener("keyup",W),o.removeEventListener("mousedown",G),window.removeEventListener("mouseup",A),window.removeEventListener("mousemove",H),o.removeEventListener("wheel",I)},M.refresh=O,M.tick=function(){if(a)return!1;if(S=!1,u&&P&&!U&&(M.pan([Y(s*(k-D)),Z(s*(K-C))]),S=!0),c&&R){var e=p*Math.exp(R/B),o=j(k),i=N(C);M.scale(1/e,[o,i]),S=!0}if(l&&P&&U){var t=z/2,r=B/2,v=D-t,d=r-K,m=k-t,w=r-C,E=n.vec2.angle([v,d],[m,w]),L=v*w-m*d;M.rotate(f*E*Math.sign(L)),S=!0}return R=0,D=k,K=C,S},M}}));
{
"name": "dom-2d-camera",
"version": "1.0.1",
"version": "1.0.2",
"description": "A wrapper for attaching a 2D camera to a DOM element",

@@ -5,0 +5,0 @@ "author": "Fritz Lekschas",

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