File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -884,8 +884,7 @@ export default class App extends React.Component<any, AppState> {
884884 } ) ;
885885 }
886886
887- onFileSelected = ( e : File [ ] ) => {
888- const file = e [ 0 ] ;
887+ setLocalPMTiles = ( file : File ) => {
889888 const pmt = new PMTiles ( new FileSource ( file ) ) ;
890889 this . setState ( {
891890 localPMTiles : pmt
@@ -906,7 +905,7 @@ export default class App extends React.Component<any, AppState> {
906905 onStyleOpen = { this . onStyleChanged }
907906 onSetMapState = { this . setMapState }
908907 onToggleModal = { this . toggleModal . bind ( this ) }
909- onFileSelected = { this . onFileSelected }
908+ setLocalPMTiles = { this . setLocalPMTiles }
910909 />
911910
912911 const layerList = < LayerList
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ type AppToolbarInternalProps = {
105105 onSetMapState ( mapState : MapState ) : unknown
106106 mapState ?: MapState
107107 renderer ?: string
108- onFileSelected ( ...args : unknown [ ] ) : unknown
108+ setLocalPMTiles ( ...args : File [ ] ) : unknown
109109} & WithTranslation ;
110110
111111class AppToolbarInternal extends React . Component < AppToolbarInternalProps > {
@@ -137,6 +137,11 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
137137 }
138138 }
139139
140+ onFileSelected = ( e : File [ ] ) => {
141+ const file = e [ 0 ] ;
142+ this . props . setLocalPMTiles ( file ) ;
143+ }
144+
140145 render ( ) {
141146 const t = this . props . t ;
142147 const views = [
@@ -293,7 +298,7 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
293298 < IconText > { t ( "Help" ) } </ IconText >
294299 </ ToolbarLink >
295300
296- < Dropzone onDrop = { this . props . onFileSelected } >
301+ < Dropzone onDrop = { this . onFileSelected } >
297302 { ( { getRootProps, getInputProps} ) => (
298303 < div { ...getRootProps ( { className : 'dropzone maputnik-toolbar-link' } ) } >
299304 < input { ...getInputProps ( ) } />
You can’t perform that action at this time.
0 commit comments