Skip to content

Commit ec62f99

Browse files
authored
Merge pull request #72 from gtt-project/fix/adjust-frontend
Adjust frontend
2 parents 47de3de + 5f589c9 commit ec62f99

File tree

13 files changed

+57
-3849
lines changed

13 files changed

+57
-3849
lines changed

assets/javascripts/app.js

Lines changed: 0 additions & 1189 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525
},
2626
"devDependencies": {
2727
"@types/ol": "^6.4.2",
28-
"@types/ol-ext": "npm:types-ol-ext",
28+
"@types/ol-ext": "npm:@siedlerchr/types-ol-ext",
2929
"css-loader": "^5.1.1",
3030
"sass": "^1.32.8",
3131
"sass-loader": "^11.0.1",
3232
"style-loader": "^2.0.0",
3333
"ts-loader": "^8.0.17",
34-
"types-ol-ext": "^1.0.5",
3534
"typescript": "^4.2.3",
3635
"webpack": "^5.24.4",
3736
"webpack-cli": "^4.5.0"

src/components/gtt-client.ts

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export class GttClient {
481481
const url = popup_contents.href.replace(/\[(.+?)\]/g, feature.get('id'))
482482
content.push(`<a href="${url}">Edit</a>`)
483483

484-
popup.show(feature.getGeometry().getFirstCoordinate(), content as any)
484+
popup.show(feature.getGeometry().getFirstCoordinate(), content.join(' ') as any)
485485
})
486486

487487
select.getFeatures().on(['remove'], _ => {
@@ -605,7 +605,7 @@ export class GttClient {
605605
}
606606

607607
getColor(feature: Feature<Geometry>): string {
608-
let color = '#FFD700'
608+
let color = '#000000'
609609
const plugin_settings = JSON.parse(this.defaults.pluginSettings)
610610
const status = document.querySelector('#issue_status_id') as HTMLInputElement
611611

@@ -622,13 +622,12 @@ export class GttClient {
622622
return color
623623
}
624624

625-
getFontColor(_: any): string {
625+
getFontColor(_: unknown): string {
626626
const color = "#FFFFFF"
627627
return color
628628
}
629629

630-
// return string but set return any because upstream jsdoc is wrong
631-
getSymbol(feature: Feature<Geometry>):any {
630+
getSymbol(feature: Feature<Geometry>) {
632631
let symbol = 'mcr-icon-write'
633632

634633
const plugin_settings = JSON.parse(this.defaults.pluginSettings)
@@ -646,7 +645,7 @@ export class GttClient {
646645
return symbol
647646
}
648647

649-
getStyle(feature: Feature<Geometry>, _: any):Style[] {
648+
getStyle(feature: Feature<Geometry>, _: unknown):Style[] {
650649
const styles: Style[] = []
651650

652651
// Apply Shadow
@@ -664,24 +663,21 @@ export class GttClient {
664663
})
665664
)
666665

667-
// rotateWithView is boolean but upstream set number
668-
const rotateWithView: any = false
669-
670666
const self = this
671667

672668
// Apply Font Style
673669
styles.push(
674670
new Style({
675671
image: new FontSymbol({
676-
form: 'mcr',
672+
form: 'blazon',
677673
gradient: false,
678674
glyph: self.getSymbol(feature),
679675
fontSize: 0.7,
680676
radius: 18,
681-
offsetY: -9, // can't set offset because upstream needs to fix jsdoc
677+
offsetY: -18,
682678
rotation: 0,
683-
rotateWithView: rotateWithView,
684-
color: self.getFontColor(feature), // can't set color because upstream needs to fix jsdoc,
679+
rotateWithView: false,
680+
color: self.getFontColor(feature),
685681
fill: new Fill({
686682
color: self.getColor(feature)
687683
}),
@@ -894,7 +890,7 @@ export class GttClient {
894890
features: [accuracyFeature, positionFeature]
895891
})
896892
})
897-
geolocationLayer.set('diplayInLayerSwitcher', false)
893+
geolocationLayer.set('displayInLayerSwitcher', false)
898894
this.map.addLayer(geolocationLayer)
899895

900896
// Control button
@@ -1136,15 +1132,11 @@ export class GttClient {
11361132

11371133
reloadFontSymbol() {
11381134
if ('fonts' in document) {
1139-
(document as any).fonts.ready.then(() => {
1135+
(document as any).fonts.addEventListener('loadingdone', () => {
11401136
let loaded = false;
11411137
(document as any).fonts.forEach((f:any) => {
1142-
if (f.family === '"mcr-icons"' || f.family === '"fontmaki"') {
1143-
if (f.status === 'unloaded') {
1144-
f.load().then(() => console.log('loaded'))
1145-
} else {
1146-
loaded = true
1147-
}
1138+
if (f.family === 'mcr-icons' || f.family === 'fontmaki') {
1139+
loaded = true
11481140
}
11491141
})
11501142
if (loaded) {
@@ -1176,18 +1168,15 @@ export class GttClient {
11761168
el.classList.toggle('icon-expended')
11771169
el.classList.toggle('icon-collapsed')
11781170
const div = fieldset.querySelector('div')
1179-
if (div.style.display !== 'block') {
1171+
if (div.style.display === 'none') {
11801172
div.style.display = 'block'
11811173
} else {
11821174
div.style.display = 'none'
11831175
}
11841176
this.maps.forEach(function (m) {
11851177
m.updateSize()
11861178
})
1187-
this.zoomToExtent()
11881179
}
1189-
1190-
11911180
}
11921181

11931182
const getTileSource = (source: string, class_name: string): any => {
@@ -1360,4 +1349,4 @@ window.replaceIssueFormWith = (html) => {
13601349
if (ol_maps) {
13611350
new GttClient({target: ol_maps})
13621351
}
1363-
}
1352+
}

src/components/gtt-setting.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export const gtt_setting = ():void => {
88
for (let i in glyph) {
99
if (glyph[i].font == font) {
1010
document.querySelectorAll("[id^='settings_tracker_']").forEach((element: HTMLSelectElement) => {
11-
element.append(new Option(glyph[i].name, i))
11+
const selected = element.value === i
12+
element.append(new Option(i, i, selected, selected))
13+
if (selected) {
14+
element.nextElementSibling.className = i
15+
}
1216
})
1317
}
1418
}

src/fonts/Redmine.eot

-4.61 KB
Binary file not shown.

src/fonts/Redmine.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/fonts/fontmaki.eot

-37.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)