|
@@ -766,6 +766,151 @@ export default class Draw {
|
|
|
this.context.restore()
|
|
|
}
|
|
|
|
|
|
+ drawTitle(geometry){
|
|
|
+ this.context.save()
|
|
|
+ this.setCanvasStyle(Style.Title)
|
|
|
+ let pt = {}
|
|
|
+ //pt.x = (this.context.canvas.width - this.context.measureText(geometry.value).width)/2
|
|
|
+ pt.x = this.context.canvas.width/2
|
|
|
+ pt.y = 50
|
|
|
+ this.context.fillText(geometry.value, pt.x, pt.y)
|
|
|
+ this.context.restore()
|
|
|
+ }
|
|
|
+
|
|
|
+ drawImage(geometry){
|
|
|
+ if(geometry.src != null){
|
|
|
+
|
|
|
+ const imgWidth = 600
|
|
|
+ const imgHeight = 400
|
|
|
+ const pt = {
|
|
|
+ x:30,
|
|
|
+ y:150
|
|
|
+ }
|
|
|
+
|
|
|
+ this.context.save()
|
|
|
+ if(geometry.image == null)
|
|
|
+ {
|
|
|
+ var img = new Image()
|
|
|
+ img.src = geometry.src;
|
|
|
+ img.crossOrigin=""
|
|
|
+ img.onload = function () {
|
|
|
+ this.context.drawImage(img, pt.x, pt.y, imgWidth, imgHeight)
|
|
|
+ }.bind(this)
|
|
|
+ geometry.image = img;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.context.drawImage(geometry.image, pt.x, pt.y, imgWidth, imgHeight)
|
|
|
+ }
|
|
|
+ this.context.restore()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ drawCompass(geometry){
|
|
|
+
|
|
|
+ this.context.save()
|
|
|
+ this.context.strokeStyle = Style.Compass.strokeStyle
|
|
|
+ this.context.fillStyle = Style.Compass.fillStyle
|
|
|
+
|
|
|
+ const center = {
|
|
|
+ x:800,
|
|
|
+ y:70
|
|
|
+ }
|
|
|
+
|
|
|
+ // const pt = {
|
|
|
+ // x:800-32/2,
|
|
|
+ // y:70+52/2
|
|
|
+ // }
|
|
|
+ this.context.translate(center.x,center.y)
|
|
|
+ this.context.rotate((geometry.angle) * Math.PI)
|
|
|
+ if(geometry.angle == 90){
|
|
|
+ this.context.translate( 32/2, -52)
|
|
|
+ }
|
|
|
+ else if(geometry.angle == 180){
|
|
|
+ this.context.translate( -32, -52)
|
|
|
+ }
|
|
|
+ else if(geometry.angle == 270){
|
|
|
+ this.context.translate( -52, -32/2)
|
|
|
+ }
|
|
|
+ this.context.lineWidth = 1
|
|
|
+ this.context.miterLimit=4;
|
|
|
+ this.context.font="15px ''";
|
|
|
+
|
|
|
+ this.context.beginPath();
|
|
|
+ this.context.moveTo(12.5221,3.262);
|
|
|
+ this.context.lineTo(8.93807,3.262);
|
|
|
+ this.context.lineTo(8.93807,4.284);
|
|
|
+ this.context.lineTo(12.5221,4.284);
|
|
|
+ this.context.lineTo(12.5221,8.204);
|
|
|
+ this.context.bezierCurveTo(11.0241,8.778,9.54007,9.352,8.51807,9.688);
|
|
|
+ this.context.lineTo(8.99407,10.724);
|
|
|
+ this.context.bezierCurveTo(10.0021,10.304,11.2761,9.786,12.5221,9.24);
|
|
|
+ this.context.lineTo(12.5221,12.334);
|
|
|
+ this.context.lineTo(13.5861,12.334);
|
|
|
+ this.context.lineTo(13.5861,0);
|
|
|
+ this.context.lineTo(12.5221,0);
|
|
|
+ this.context.lineTo(12.5221,3.262);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.moveTo(17.6881,11.13);
|
|
|
+ this.context.bezierCurveTo(17.0721,11.13,16.9601,11.004,16.9601,10.29);
|
|
|
+ this.context.lineTo(16.9601,5.726);
|
|
|
+ this.context.bezierCurveTo(18.4581,4.9,20.0821,3.934,21.2581,2.982);
|
|
|
+ this.context.lineTo(20.4181,2.114);
|
|
|
+ this.context.bezierCurveTo(19.5781,2.912,18.2621,3.85,16.9601,4.648);
|
|
|
+ this.context.lineTo(16.9601,0);
|
|
|
+ this.context.lineTo(15.8961,0);
|
|
|
+ this.context.lineTo(15.8961,10.276);
|
|
|
+ this.context.bezierCurveTo(15.8961,11.746,16.2741,12.152,17.5901,12.152);
|
|
|
+ this.context.lineTo(19.7741,12.152);
|
|
|
+ this.context.bezierCurveTo(21.1321,12.152,21.4261,11.27,21.5521,8.722);
|
|
|
+ this.context.bezierCurveTo(21.2581,8.652,20.8241,8.442,20.5441,8.232);
|
|
|
+ this.context.bezierCurveTo(20.4461,10.556,20.3481,11.13,19.6901,11.13);
|
|
|
+ this.context.lineTo(17.6881,11.13);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.fill();
|
|
|
+ this.context.stroke();
|
|
|
+
|
|
|
+ this.context.beginPath();
|
|
|
+ this.context.moveTo(24.8494,49.3321);
|
|
|
+ this.context.lineTo(28.7452,51);
|
|
|
+ this.context.lineTo(27.3498,47.2775);
|
|
|
+ this.context.bezierCurveTo(30.224,44.385,32,40.3999,32,36);
|
|
|
+ this.context.bezierCurveTo(32,27.5465,25.4442,20.6242,17.1394,20.0399);
|
|
|
+ this.context.lineTo(15.9998,17);
|
|
|
+ this.context.lineTo(14.8602,20.04);
|
|
|
+ this.context.bezierCurveTo(6.55559,20.6245,0,27.5467,0,36);
|
|
|
+ this.context.bezierCurveTo(0,40.3998,1.77588,44.3847,4.64993,47.2772);
|
|
|
+ this.context.lineTo(3.25439,51);
|
|
|
+ this.context.lineTo(7.15046,49.3319);
|
|
|
+ this.context.bezierCurveTo(9.68503,51.0177,12.7278,52,16,52);
|
|
|
+ this.context.bezierCurveTo(19.2721,52,22.3148,51.0178,24.8494,49.3321);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.moveTo(26.5656,45.1856);
|
|
|
+ this.context.lineTo(17.9232,22.131);
|
|
|
+ this.context.bezierCurveTo(24.7452,23.0683,30,28.9205,30,36);
|
|
|
+ this.context.bezierCurveTo(30,39.5148,28.7048,42.7271,26.5656,45.1856);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.moveTo(14.0763,22.1311);
|
|
|
+ this.context.lineTo(5.43414,45.1852);
|
|
|
+ this.context.bezierCurveTo(3.29512,42.7268,2,39.5146,2,36);
|
|
|
+ this.context.bezierCurveTo(2,28.9206,7.25457,23.0685,14.0763,22.1311);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.moveTo(7.43459,47.0749);
|
|
|
+ this.context.bezierCurveTo(7.28407,46.9583,7.13599,46.8387,6.99045,46.7162);
|
|
|
+ this.context.lineTo(15,25.3497);
|
|
|
+ this.context.lineTo(15,43.8358);
|
|
|
+ this.context.lineTo(7.43459,47.0749);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.moveTo(9.4198,48.3604);
|
|
|
+ this.context.lineTo(15.9998,45.5432);
|
|
|
+ this.context.lineTo(22.58,48.3605);
|
|
|
+ this.context.bezierCurveTo(20.6184,49.4069,18.3785,50,16,50);
|
|
|
+ this.context.bezierCurveTo(13.6214,50,11.3814,49.4068,9.4198,48.3604);
|
|
|
+ this.context.closePath();
|
|
|
+ this.context.fill();
|
|
|
+ this.context.stroke();
|
|
|
+ this.context.restore();
|
|
|
+ }
|
|
|
+
|
|
|
setCanvasStyle(style) {
|
|
|
for (const key in style) {
|
|
|
if (key != 'isFill' && key != 'isStroke') {
|