This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community. Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it. https://www.freifunk-altdorf.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 lines
954 B

var Shape = require('./generic');
module.exports = Shape(function(width, height, radius){
this.width = width;
this.height = height;
var path = this.path;
if (!radius){
path.move(0, 0).line(width, 0).line(0, height).line(-width, 0).line(0, -height);
} else {
if (typeof radius == 'number') radius = [radius, radius, radius, radius];
var tl = radius[0], tr = radius[1], br = radius[2], bl = radius[3];
if (tl < 0) tl = 0;
if (tr < 0) tr = 0;
if (bl < 0) bl = 0;
if (br < 0) br = 0;
path.move(0, tl);
if (width < 0) path.move(width, 0);
if (height < 0) path.move(0, height);
if (tl > 0) path.arc(tl, -tl);
path.line(Math.abs(width) - (tr + tl), 0);
if (tr > 0) path.arc(tr, tr);
path.line(0, Math.abs(height) - (tr + br));
if (br > 0) path.arc(-br, br);
path.line(- Math.abs(width) + (br + bl), 0);
if (bl > 0) path.arc(-bl, -bl);
path.line(0, - Math.abs(height) + (bl + tl));
}
path.close();
});