Compare commits

..

2 Commits

Author SHA1 Message Date
Willem Dantuma
b17bce1cd2 Add default unitScale
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-01-25 20:18:04 +01:00
Willem Dantuma
bb555eec74 Remove fill colors for selected items 2021-01-25 18:28:26 +01:00
3 changed files with 84 additions and 86 deletions

View File

@ -116,8 +116,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[key]) {
let itemType = this.itemTypeService.itemTypes[key];
let fillColor = color.asArray(itemType.iconColor);
fillColor[3] = this.selectedItem?0:0.5;
this.stylesCache[key] = new style.Style({
image: itemType.icon ? new style.Icon({
anchor: [0.5, 1],
@ -128,9 +126,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
color: 'red',
width: 1
}),
fill: new style.Fill({
color: fillColor
}),
geometry:(feature) => this.geometry(feature)
});
} else {

View File

@ -64,9 +64,6 @@ export class MapEffects {
stroke: new style.Stroke({
color: 'red',
width: 1
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
})));
actions.push(new mapActions.SetStyle('selected',new style.Style({
@ -78,9 +75,6 @@ export class MapEffects {
stroke: new style.Stroke({
color: 'red',
width: 3
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
})));

View File

@ -64,12 +64,21 @@ export class TimespanService {
return this.getStartEndCaption(new Date(endDate.getTime() - (this.unitScales[unitScale] / 2)), startDate, unitScale, suffix);
}
getCaption(startDate: Date, endDate: Date, unitScale: number): string {
let startCaption = this.getStartCaption(startDate, endDate, unitScale);
let endCaption = this.getEndCaption(startDate,endDate, unitScale);
if ((endDate.getTime() - startDate.getTime()) < (1.5 * this.unitScales[unitScale]))
getCaption(startDate: Date, endDate: Date, unitScale?: number): string {
let scale = unitScale;
if(unitScale==null) {
scale=4;
if(startDate.getUTCMonth() == 0 && startDate.getUTCDate() == 1 && startDate.getUTCHours() == 0 && startDate.getUTCMinutes() ==0 && startDate.getUTCSeconds() ==0 &&
endDate.getUTCMonth() == 0 && endDate.getUTCDate() == 1 && endDate.getUTCHours() == 0 && endDate.getUTCMinutes() ==0 && endDate.getUTCSeconds() ==0) {
scale=8;
} else if (startDate.getUTCHours() > 0 && startDate.getUTCMinutes() >0) {
scale =3
}
}
let startCaption = this.getStartCaption(startDate, endDate, scale);
let endCaption = this.getEndCaption(startDate,endDate, scale);
if ((endDate.getTime() - startDate.getTime()) < (1.5 * this.unitScales[scale]))
return endCaption;
return `${startCaption}-${endCaption}`;
}
}