File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -886,23 +886,28 @@ export class GttClient {
886
886
*/
887
887
parseHistory ( ) {
888
888
document . querySelectorAll ( 'div#history ul.details i' ) . forEach ( ( item : Element ) => {
889
- const regex = new RegExp ( / \w + [ \s ] ? ( \( ( - ? \d + .\d + \s ? - ? \d + .\d + , ? ) + \) ) + / g)
889
+ const regex = new RegExp ( / \w + [ \s ] ? ( \( * ( - ? \d + .\d + \s ? - ? \d + .\d + , ? ) + \) * ) + / g)
890
890
const match = item . innerHTML . match ( regex )
891
891
if ( match !== null ) {
892
892
const feature = new WKT ( ) . readFeature (
893
- match [ 0 ] , {
893
+ match . join ( '' ) , {
894
894
dataProjection : 'EPSG:4326' ,
895
895
featureProjection : 'EPSG:3857'
896
896
}
897
897
)
898
- const wkt = new WKT ( ) . writeFeature (
898
+ let wkt = new WKT ( ) . writeFeature (
899
899
feature , {
900
900
dataProjection : 'EPSG:4326' ,
901
901
featureProjection : 'EPSG:3857' ,
902
- decimals : 6
902
+ decimals : 5
903
903
}
904
904
)
905
- item . innerHTML = `<a href="#" onclick="event.preventDefault();" class="wkt">${ wkt } </a>`
905
+ // Shorten long WKT's
906
+ if ( wkt . length > 30 ) {
907
+ const parts = wkt . split ( ' ' )
908
+ wkt = parts [ 0 ] + '...' + parts [ parts . length - 1 ]
909
+ }
910
+ item . innerHTML = `<a href="#" onclick="event.preventDefault();" class="wkt" data-feature="${ match . join ( '' ) } ">${ wkt } </a>`
906
911
}
907
912
} )
908
913
}
You can’t perform that action at this time.
0 commit comments