UNPKG

konva

Version:

<p align="center"> <img src="https://raw.githubusercontent.com/konvajs/konvajs.github.io/master/apple-touch-icon-180x180.png" alt="Konva logo" height="180" /> </p>

84 lines (83 loc) 2.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var PI_OVER_180 = Math.PI / 180; function detectBrowser() { return (typeof window !== 'undefined' && ({}.toString.call(window) === '[object Window]' || {}.toString.call(window) === '[object global]')); } var _detectIE = function (ua) { var msie = ua.indexOf('msie '); if (msie > 0) { return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); } var trident = ua.indexOf('trident/'); if (trident > 0) { var rv = ua.indexOf('rv:'); return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); } var edge = ua.indexOf('edge/'); if (edge > 0) { return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); } return false; }; exports._parseUA = function (userAgent) { var ua = userAgent.toLowerCase(), match = /(chrome)[ /]([\w.]+)/.exec(ua) || /(webkit)[ /]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ /]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || (ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)) || [], mobile = !!userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i), ieMobile = !!userAgent.match(/IEMobile/i); return { browser: match[1] || '', version: match[2] || '0', isIE: _detectIE(ua), mobile: mobile, ieMobile: ieMobile }; }; exports.glob = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' ? self : {}; exports.Konva = { _global: exports.glob, version: '3.3.3', isBrowser: detectBrowser(), isUnminified: /param/.test(function (param) { }.toString()), dblClickWindow: 400, getAngle: function (angle) { return exports.Konva.angleDeg ? angle * PI_OVER_180 : angle; }, enableTrace: false, _pointerEventsEnabled: false, listenClickTap: false, inDblClickWindow: false, pixelRatio: undefined, dragDistance: 3, angleDeg: true, showWarnings: true, dragButtons: [0, 1], isDragging: function () { return exports.Konva['DD'].isDragging; }, isDragReady: function () { return !!exports.Konva['DD'].node; }, UA: exports._parseUA((exports.glob.navigator && exports.glob.navigator.userAgent) || ''), document: exports.glob.document, _injectGlobal: function (Konva) { exports.glob.Konva = Konva; }, _parseUA: exports._parseUA }; exports._NODES_REGISTRY = {}; exports._registerNode = function (NodeClass) { exports._NODES_REGISTRY[NodeClass.prototype.getClassName()] = NodeClass; exports.Konva[NodeClass.prototype.getClassName()] = NodeClass; };