forked from espruino/BangleApps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dane_arwes.min.js
1 lines (1 loc) · 1.66 KB
/
dane_arwes.min.js
1
function Arwes(a,b){this.cornerSize=a,this.cornerOffset=b}function drawCorner(a,d,e,i){g.setColor(a.C.color.primary.base);let b=i&1?1:-1,c=i&2?1:-1;const f=d+a.cornerOffset*b;const h=e+a.cornerOffset*c;g.fillRect(f,h,d-a.cornerSize*b+a.cornerOffset*b,e),g.fillRect(f,h,d,e-a.cornerSize*c+a.cornerOffset*c)}var C={cornerSize:14,cornerOffset:3,borderWidth:1};Arwes.prototype.C={color:{primary:{base:'#26dafd',light:'#8bebfe',dark:'#029dbb'},secondary:{base:'#df9527',light:'#ecc180',dark:'#8b5c15'},header:{base:'#a1ecfb',light:'#fff',dark:'#3fd8f7'},control:{base:'#acf9fb',light:'#fff',dark:'#4bf2f6'},success:{base:'#00ff00',light:'#6f6',dark:'#090'},alert:{base:'#ff0000',light:'#f66',dark:'#900'},disabled:{base:'#999999',light:'#ccc',dark:'#666'}}},Arwes.prototype.drawFrameNoCorners=function(a,b,c,d){g.setColor(this.C.color.primary.dark),g.drawRect(a,b,c,d)},Arwes.prototype.drawFrame=function(a,b,c,d){drawCorner(this,a,b,0),drawCorner(this,c,b,1),drawCorner(this,a,d,2),drawCorner(this,c,d,3),this.drawFrameNoCorners(a,b,c,d)},Arwes.prototype.drawFrameBottomCorners=function(b,d,c,a){drawCorner(this,b,a,2),drawCorner(this,c,a,3),this.drawFrameNoCorners(b,d,c,a)},Arwes.prototype.drawFrameTopCorners=function(b,a,c,d){drawCorner(this,b,a,0),drawCorner(this,c,a,1),this.drawFrameNoCorners(b,a,c,d)},Arwes.prototype.drawFrameLeftCorners=function(a,b,d,c){drawCorner(this,a,b,0),drawCorner(this,a,c,2),this.drawFrameNoCorners(a,b,d,c)},Arwes.prototype.drawFrameRightCorners=function(d,b,a,c){drawCorner(this,a,b,1),drawCorner(this,a,c,3),this.drawFrameNoCorners(d,b,a,c)},exports.create=function(a,b){return new Arwes(a,b)},exports.default=function(){return new Arwes(C.cornerSize,C.cornerOffset)}