Add support for alpha in legend
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
3008081ae8
commit
394bbab320
@ -81,7 +81,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
color: this.rgbaToHex(red, green, blue, alpha)
|
||||
}),
|
||||
stroke: new style.Stroke({
|
||||
color: this.rgbaToHex(red, green, blue, alpha),
|
||||
color: this.rgbaToHex(red, green, blue, 255),
|
||||
width: 1.25
|
||||
}),
|
||||
});
|
||||
|
@ -17,7 +17,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
|
||||
<td class="legend-items"><span [style.background-color]="getHex(entry.color)" class="color"></span></td>
|
||||
<td class="legend-items"><span [style.background-color]="getAlphaHex(entry.color)" [style.border-color]="getHex(entry.color)"class="color"></span></td>
|
||||
<td class="legend-items-text"><span *ngIf="!entry.label">{{getScaledValue(entry.value,layer.scale) | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
|
||||
<td class="histogram-items">
|
||||
<div *ngIf="showHistogram()">
|
||||
|
@ -20,6 +20,7 @@ span.color {
|
||||
display:inline-block;
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
border: 2px solid;
|
||||
}
|
||||
|
||||
.legend-items {
|
||||
|
@ -53,6 +53,10 @@ export class LegendComponent implements OnInit,AfterViewInit {
|
||||
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
|
||||
}
|
||||
|
||||
public getAlphaHex(color: IColor): string {
|
||||
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue)+ this.componentToHex(color.alpha);
|
||||
}
|
||||
|
||||
private componentToHex(c: number): string {
|
||||
const hex = c.toString(16);
|
||||
return hex.length === 1 ? `0${hex}` : hex;
|
||||
|
Loading…
Reference in New Issue
Block a user