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.

61 lines
1.2 KiB

var Class = require('../../core/class');
var Path = require('../../core/path');
var CanvasPath = Class(Path, {
initialize: function(path){
this.reset();
if (path instanceof CanvasPath){
this.path = path.path.slice(0);
} else if (path){
if (path.applyToPath)
path.applyToPath(this);
else
this.push(path);
}
},
onReset: function(){
this.path = [];
},
onMove: function(sx, sy, x, y){
this.path.push(function(context){
context.moveTo(x, y);
});
},
onLine: function(sx, sy, x, y){
this.path.push(function(context){
context.lineTo(x, y);
});
},
onBezierCurve: function(sx, sy, p1x, p1y, p2x, p2y, x, y){
this.path.push(function(context){
context.bezierCurveTo(p1x, p1y, p2x, p2y, x, y);
});
},
_arcToBezier: Path.prototype.onArc,
onArc: function(sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation){
if (rx != ry || rotation) return this._arcToBezier(sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation);
this.path.push(function(context){
context.arc(cx, cy, rx, sa, ea, ccw);
});
},
onClose: function(){
this.path.push(function(context){
context.closePath();
});
},
toCommands: function(){
return this.path.slice(0);
}
});
module.exports = CanvasPath;