Skip to content

Commit 597bdd6

Browse files
authored
Merge pull request #102 from Sybit-Education/feature/individual-pin-scaleing
feat: individual scaling added to types
2 parents 333c67a + 017209d commit 597bdd6

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/app/components/map/map.component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export class MapComponent implements OnInit {
2525
map!: Map;
2626
vectorSource!: VectorSource;
2727

28-
iconSize = 0.15;
28+
//iconSize = 0.15;
2929
center = [8.970869314606485, 47.73981783654207];
3030
userLocationFeature: Feature = new Feature();
3131

32-
@ViewChild('tooltip_map', {static: true}) tooltip!: ElementRef;
32+
@ViewChild('tooltip_map', {static: true}) tooltip!: ElementRef;
3333

3434
constructor(private router: Router, private airtableService: AirtableService, private geolocationService: GeolocationService) {}
3535

@@ -74,7 +74,7 @@ export class MapComponent implements OnInit {
7474
scale: 0.05 // Größe des Pins
7575
})
7676
}));
77-
77+
7878
this.vectorSource.addFeature(this.userLocationFeature);
7979
this.map.on('click', this.handleMapClick.bind(this));
8080
this.map.on('pointermove', this.handlePointerMove.bind(this));
@@ -91,7 +91,7 @@ export class MapComponent implements OnInit {
9191
image: new Icon({
9292
src: 'data:image/svg+xml;utf8,' + activity.type.svg,
9393
color: this.getColor(activity),
94-
size: [this.iconSize, this.iconSize]
94+
size: [activity.type.svg_scale, activity.type.svg_scale]
9595
})
9696
})
9797
});
@@ -104,7 +104,7 @@ export class MapComponent implements OnInit {
104104
image: new Icon({
105105
src: 'data:image/svg+xml;utf8,' + activity.type.svg,
106106
color: this.getColor(activity),
107-
scale: this.iconSize
107+
scale: activity.type.svg_scale
108108
})
109109
}));
110110
});
@@ -141,7 +141,7 @@ export class MapComponent implements OnInit {
141141
image: new Icon({
142142
src: 'data:image/svg+xml;utf8,' + activity.type.svg,
143143
color: this.getColor(activity),
144-
scale: this.iconSize,
144+
scale: activity.type.svg_scale
145145
})
146146
}));
147147
}
@@ -157,7 +157,7 @@ export class MapComponent implements OnInit {
157157
image: new Icon({
158158
src: 'data:image/svg+xml;utf8,' + activity.type.svg,
159159
color: this.getColor(activity),
160-
scale: this.iconSize
160+
scale: activity.type.svg_scale
161161
})
162162
}));
163163
});
@@ -175,10 +175,10 @@ export class MapComponent implements OnInit {
175175
console.log('Center: ', this.center);
176176
this.map.getView().setCenter(fromLonLat(this.center));
177177
const coordinates = fromLonLat(this.center);
178-
this.userLocationFeature.setGeometry(new Point(coordinates));
178+
this.userLocationFeature.setGeometry(new Point(coordinates));
179179
})
180180
.catch(error => {
181181
console.error('Error getting location: ', error);
182182
});
183-
}
183+
}
184184
}

src/app/services/airtable.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export class AirtableService {
4242
id: record["id"] as string,
4343
name: record.fields["name"] as string,
4444
color: record.fields["color"] as string,
45-
svg: record.fields["svg"] as string
45+
svg: record.fields["svg"] as string,
46+
svg_scale: record.fields["svg_scale"] as number
4647
};
4748
});
4849
}),);

src/app/types/types.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ export interface TypesInterface {
22
id?: string,
33
name: string,
44
color: string,
5-
svg: string
6-
5+
svg: string,
6+
svg_scale: number
77
}

0 commit comments

Comments
 (0)