Created
January 22, 2021 03:53
-
-
Save miguelcobain/65e696c788b9a0b2433e110e6d32873f to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import { tracked } from "@glimmer/tracking"; | |
import { action } from "@ember/object"; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
@tracked lat = 38.77; | |
@tracked long = -100.79; | |
@tracked zoom = 3; | |
@action | |
onMapLoad(event) { | |
this.map = event.target; | |
this.invalidateSize(); | |
} | |
@action | |
onTabChange(event) { | |
this.invalidateSize(); | |
} | |
invalidateSize() { | |
// ember-bootstrap tabs do not have any event | |
// that fires when the tab is finished transitioning | |
// so we have to tell leaflet to | |
// recalculate its size after X ms, ideally equal to the | |
// css transition duration | |
setTimeout(() => { | |
this.map?.invalidateSize(); | |
}, 200); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.leaflet-container { | |
height: 300px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1", | |
"leaflet": "1.7.1", | |
"bootstrap": "4.5.3" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"ember-bootstrap": "3.1.4", | |
"ember-leaflet": "4.1.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment