1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-30 11:40:27 +02:00

incomplete gfx-api liftout

This commit is contained in:
Pomax
2017-03-31 07:51:53 -07:00
parent 7140fe7ad7
commit f4861ccacc
7 changed files with 99409 additions and 66 deletions

View File

@@ -52,9 +52,11 @@ var baseClass = {
}
};
// For some reason we can copy from gfx into base but
// not the other way around, while preserving context.
var gfxObject = require("./gfx-api");
Object.keys(baseClass).forEach(fname => {
gfxObject[fname] = baseClass[fname];
Object.keys(gfxObject).forEach(fname => {
baseClass[fname] = gfxObject[fname];
});
module.exports = React.createClass(gfxObject);
module.exports = React.createClass(baseClass);

View File

@@ -1,6 +1,6 @@
var hasWindow = (typeof window !== "undefined");
var chroma = hasWindow ? window.chroma : require("chroma-js");
var Bezier = hasWindow ? window.Bezier : require("bezier-js");
var chroma = /*hasWindow ? window.chroma : */require("chroma-js");
var Bezier = /*hasWindow ? window.Bezier : */require("bezier-js");
// event coordinate fix
var fix = function(e) {
@@ -11,7 +11,7 @@ var fix = function(e) {
e.offsetY = e.clientY - rect.top;
};
const API = {
var API = {
Paper: false,
defaultWidth: 275,
@@ -607,4 +607,5 @@ const API = {
}
};
if (hasWindow) { window["Bezier Graphics API"] = API; } else { module.exports = API; }
if (hasWindow) { window["Bezier Graphics API"] = API; }
if (typeof module !== "undefined") { module.exports = API; }