mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
75 lines
2.1 KiB
JavaScript
75 lines
2.1 KiB
JavaScript
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
|
|
|
var fabric = fabric || { version: "1.7.1" };
|
|
if (typeof exports !== 'undefined') {
|
|
exports.fabric = fabric;
|
|
}
|
|
|
|
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
|
|
fabric.document = document;
|
|
fabric.window = window;
|
|
// ensure globality even if entire library were function wrapped (as in Meteor.js packaging system)
|
|
window.fabric = fabric;
|
|
}
|
|
else {
|
|
// assume we're running under node.js when document/window are not present
|
|
fabric.document = require("jsdom")
|
|
.jsdom("<!DOCTYPE html><html><head></head><body></body></html>");
|
|
|
|
if (fabric.document.createWindow) {
|
|
fabric.window = fabric.document.createWindow();
|
|
} else {
|
|
fabric.window = fabric.document.parentWindow;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* True when in environment that supports touch events
|
|
* @type boolean
|
|
*/
|
|
fabric.isTouchSupported = "ontouchstart" in fabric.document.documentElement;
|
|
|
|
/**
|
|
* True when in environment that's probably Node.js
|
|
* @type boolean
|
|
*/
|
|
fabric.isLikelyNode = typeof Buffer !== 'undefined' &&
|
|
typeof window === 'undefined';
|
|
|
|
/* _FROM_SVG_START_ */
|
|
/**
|
|
* Attributes parsed from all SVG elements
|
|
* @type array
|
|
*/
|
|
fabric.SHARED_ATTRIBUTES = [
|
|
"display",
|
|
"transform",
|
|
"fill", "fill-opacity", "fill-rule",
|
|
"opacity",
|
|
"stroke", "stroke-dasharray", "stroke-linecap",
|
|
"stroke-linejoin", "stroke-miterlimit",
|
|
"stroke-opacity", "stroke-width",
|
|
"id"
|
|
];
|
|
/* _FROM_SVG_END_ */
|
|
|
|
/**
|
|
* Pixel per Inch as a default value set to 96. Can be changed for more realistic conversion.
|
|
*/
|
|
fabric.DPI = 96;
|
|
fabric.reNum = '(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)';
|
|
fabric.fontPaths = { };
|
|
|
|
/**
|
|
* Cache Object for widths of chars in text rendering.
|
|
*/
|
|
fabric.charWidthsCache = { };
|
|
|
|
/**
|
|
* Device Pixel Ratio
|
|
* @see https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/HTML-canvas-guide/SettingUptheCanvas/SettingUptheCanvas.html
|
|
*/
|
|
fabric.devicePixelRatio = fabric.window.devicePixelRatio ||
|
|
fabric.window.webkitDevicePixelRatio ||
|
|
fabric.window.mozDevicePixelRatio ||
|
|
1;
|