comparison client/src/components/fairway/Fairwayprofile.vue @ 4523:cb1f62335b00

Client: fairwayprofile: fix drawing of fairway-box * pass the opacity in the (rgba) value instead of additional attribute for it.
author Fadi Abbud <fadi.abbud@intevation.de>
date Mon, 07 Oct 2019 12:12:06 +0200
parents 4c3851391b6d
children 63fceb662047
comparison
equal deleted inserted replaced
4522:7fb29172befa 4523:cb1f62335b00
285 .getLayer("FAIRWAYDIMENSIONSLOS" + los) 285 .getLayer("FAIRWAYDIMENSIONSLOS" + los)
286 .getStyle()()[0]; 286 .getStyle()()[0];
287 287
288 // use spread operator to clone arrays 288 // use spread operator to clone arrays
289 let fillColor = style.getFill().getColor(); 289 let fillColor = style.getFill().getColor();
290 let fillOpacity = 290
291 fillColor.length < 8
292 ? 0.8
293 : parseFloat(parseInt(fillColor.slice(7), 16) / 255).toFixed(2);
294 let strokeColor = style.getStroke().getColor(); 291 let strokeColor = style.getStroke().getColor();
295 let strokeOpacity =
296 strokeColor.length < 8
297 ? 0.8
298 : parseFloat(parseInt(strokeColor.slice(7), 16) / 255).toFixed(2);
299 let strokeDash = style.getStroke().getLineDash(); 292 let strokeDash = style.getStroke().getLineDash();
300 return { fillColor, fillOpacity, strokeColor, strokeOpacity, strokeDash }; 293 return { fillColor, strokeColor, strokeDash };
301 }, 294 },
302 applyChange() { 295 applyChange() {
303 if (this.form.template.hasOwnProperty("properties")) { 296 if (this.form.template.hasOwnProperty("properties")) {
304 this.templateData = this.defaultTemplate; 297 this.templateData = this.defaultTemplate;
305 return; 298 return;
477 .datum([ 470 .datum([
478 { x: startPoint, y: this.useCustomDepth ? this.depth : depth }, 471 { x: startPoint, y: this.useCustomDepth ? this.depth : depth },
479 { x: endPoint, y: this.useCustomDepth ? this.depth : depth } 472 { x: endPoint, y: this.useCustomDepth ? this.depth : depth }
480 ]) 473 ])
481 .attr("fill", `${this.getLayerStyle(data.los).fillColor}`) 474 .attr("fill", `${this.getLayerStyle(data.los).fillColor}`)
482 .attr("fill-opacity", this.getLayerStyle(data.los).fillOpacity)
483 .attr("stroke", `${this.getLayerStyle(data.los).strokeColor}`) 475 .attr("stroke", `${this.getLayerStyle(data.los).strokeColor}`)
484 .attr("stroke-opacity", this.getLayerStyle(data.los).strokeOpacity)
485 .attr("stroke-dasharray", this.getLayerStyle(data.los).strokeDash) 476 .attr("stroke-dasharray", this.getLayerStyle(data.los).strokeDash)
486 .attr("d", fairwayArea) 477 .attr("d", fairwayArea)
487 .attr("transform", `translate(0 ${-offsetY})`); 478 .attr("transform", `translate(0 ${-offsetY})`);
488 }); 479 });
489 } 480 }