2016-11-12 23:57:55 +00:00
|
|
|
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
2011-07-15 22:16:14 +00:00
|
|
|
|
2016-12-01 22:56:21 +00:00
|
|
|
var fabric = fabric || { version: "1.7.1" };
|
2013-09-23 12:34:07 +00:00
|
|
|
if (typeof exports !== 'undefined') {
|
|
|
|
|
exports.fabric = fabric;
|
|
|
|
|
}
|
2011-08-05 23:00:26 +00:00
|
|
|
|
2012-11-13 17:06:53 +00:00
|
|
|
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
2011-08-11 19:18:18 +00:00
|
|
|
fabric.document = document;
|
|
|
|
|
fabric.window = window;
|
2014-12-31 11:32:32 +00:00
|
|
|
// ensure globality even if entire library were function wrapped (as in Meteor.js packaging system)
|
2014-12-29 16:52:15 +00:00
|
|
|
window.fabric = fabric;
|
2011-08-11 19:18:18 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// assume we're running under node.js when document/window are not present
|
2013-11-20 11:50:32 +00:00
|
|
|
fabric.document = require("jsdom")
|
|
|
|
|
.jsdom("<!DOCTYPE html><html><head></head><body></body></html>");
|
|
|
|
|
|
2014-11-01 16:41:01 +00:00
|
|
|
if (fabric.document.createWindow) {
|
|
|
|
|
fabric.window = fabric.document.createWindow();
|
2014-11-03 21:35:42 +00:00
|
|
|
} else {
|
|
|
|
|
fabric.window = fabric.document.parentWindow;
|
2014-11-01 16:41:01 +00:00
|
|
|
}
|
2011-09-21 23:29:00 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-22 16:40:31 +00:00
|
|
|
/**
|
|
|
|
|
* True when in environment that supports touch events
|
|
|
|
|
* @type boolean
|
|
|
|
|
*/
|
2012-07-29 10:38:01 +00:00
|
|
|
fabric.isTouchSupported = "ontouchstart" in fabric.document.documentElement;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* True when in environment that's probably Node.js
|
|
|
|
|
* @type boolean
|
|
|
|
|
*/
|
2013-11-20 11:50:32 +00:00
|
|
|
fabric.isLikelyNode = typeof Buffer !== 'undefined' &&
|
|
|
|
|
typeof window === 'undefined';
|
|
|
|
|
|
2015-03-27 06:36:58 +00:00
|
|
|
/* _FROM_SVG_START_ */
|
2013-11-20 11:50:32 +00:00
|
|
|
/**
|
|
|
|
|
* Attributes parsed from all SVG elements
|
|
|
|
|
* @type array
|
|
|
|
|
*/
|
2013-10-28 13:01:44 +00:00
|
|
|
fabric.SHARED_ATTRIBUTES = [
|
2014-04-10 21:47:36 +00:00
|
|
|
"display",
|
2013-10-28 13:01:44 +00:00
|
|
|
"transform",
|
|
|
|
|
"fill", "fill-opacity", "fill-rule",
|
|
|
|
|
"opacity",
|
2013-11-20 11:50:32 +00:00
|
|
|
"stroke", "stroke-dasharray", "stroke-linecap",
|
|
|
|
|
"stroke-linejoin", "stroke-miterlimit",
|
2015-07-01 14:25:02 +00:00
|
|
|
"stroke-opacity", "stroke-width",
|
|
|
|
|
"id"
|
2013-10-28 13:01:44 +00:00
|
|
|
];
|
2015-03-27 06:36:58 +00:00
|
|
|
/* _FROM_SVG_END_ */
|
2014-07-17 14:28:42 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pixel per Inch as a default value set to 96. Can be changed for more realistic conversion.
|
|
|
|
|
*/
|
|
|
|
|
fabric.DPI = 96;
|
2014-10-21 20:50:34 +00:00
|
|
|
fabric.reNum = '(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)';
|
2016-02-11 01:11:17 +00:00
|
|
|
fabric.fontPaths = { };
|
2015-07-10 15:13:51 +00:00
|
|
|
|
2016-05-23 06:16:59 +00:00
|
|
|
/**
|
|
|
|
|
* Cache Object for widths of chars in text rendering.
|
|
|
|
|
*/
|
|
|
|
|
fabric.charWidthsCache = { };
|
|
|
|
|
|
2015-07-10 15:13:51 +00:00
|
|
|
/**
|
|
|
|
|
* Device Pixel Ratio
|
|
|
|
|
* @see https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/HTML-canvas-guide/SettingUptheCanvas/SettingUptheCanvas.html
|
|
|
|
|
*/
|
2015-07-22 13:24:51 +00:00
|
|
|
fabric.devicePixelRatio = fabric.window.devicePixelRatio ||
|
|
|
|
|
fabric.window.webkitDevicePixelRatio ||
|
|
|
|
|
fabric.window.mozDevicePixelRatio ||
|
2015-07-10 15:13:51 +00:00
|
|
|
1;
|