Skip to content

Instantly share code, notes, and snippets.

@dansnetwork
Forked from geedew/broken.js
Last active August 30, 2018 17:47
Show Gist options
  • Save dansnetwork/7219122 to your computer and use it in GitHub Desktop.
Save dansnetwork/7219122 to your computer and use it in GitHub Desktop.
;(function(win, undefined) {
"use strict";
var applicationName = "My Broken App";
let raphaelLoaded = false;
const numLibs = 1;
libs = { one : 'jQuery', two : 'Underscore', three : 'Backbone' };
BioSync.Common.loadLibs = function( libraries = {} ) {
var e = 0, r;
BioSync.Common.applicationName = applicationName;
delete applicationName;
Object.prototype.graphicsLib = 'raphael';
for( library in libraries ) {
numLibs++;
BioSync.Common.loadScript( { name: library } );
BioSync.Common.loadCSS( { name: library } );
if( library === 'raphael' ) {
raphaelLoaded = true;
Raphael.fn.circlePath = (x, y, r) => {
var s = "M" + x + "," + (y-r) + "A"+r+","+r+",0,1,1,"+(x-0.1)+","+(y-r)+" z";
return s;
}
Raphael.fn.quarterCirclePath = (x, y, r, id) => {
if( id == 0 ) {
x1 = x; y1 = y - r; x2 = x+r; y2 = y; rot = r;
} else if( id == 1 ) {
x1 = x+r; y1 = y; x2 = x; y2 = y+r; rot = r;
} else if( id == 2 ) {
x1 = x; y1 = y+r; x2 = x-r; y2 = y; rot = -r;
} else if( id == 3 ) {
x1 = x-r; y1 = y; x2 = x; y2 = y-r; rot = -r;
}
var s = [ 'M', x1, y1, 'A', r, r, r, 0, 1, x2, y2 ].join(' ');
return s;
}
}
}
}
BioSync.Common.loadLibs(libs);
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment