Skip to content

Instantly share code, notes, and snippets.

@davidpett
Last active January 2, 2017 16:58
Show Gist options
  • Save davidpett/afbe11c10568360006c5fbf23926aefd to your computer and use it in GitHub Desktop.
Save davidpett/afbe11c10568360006c5fbf23926aefd to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
tileId: 'wac_12758',
tileHeight: 2944,
tileSubdomains: ['', '0', '1', '2'],
tileWidth: 4000,
tileUrl: Ember.computed('tileId', function() {
return `http://cdn{s}.walkerart.org/public/collections-tiled/${this.get('tileId')}/{z}_{x}_{y}.jpg`;
}),
tileBounds: Ember.computed('tileHeight', 'tileWidth', function() {
let p1 = L.latLng(0, this.get('tileHeight'));
let p2 = L.latLng(this.get('tileWidth'), 0);
return L.latLngBounds(p1, p2);
})
});
<ul>
<li>width: {{tileWidth}}</li>
<li>height: {{tileHeight}}</li>
<li>tileId: {{tileId}}</li>
</ul>
{{#leaflet-map lat="0" lng="0" zoom="2" as |layers|}}
{{layers.tile
url=tileUrl
noWrap=true
subdomains=tileSubdomains
continuousWorld=false
tms=false
detectRetina=false
unloadInvisibleTiles=false
reuseTiles=true
updateWhenIdle=false
minZoom=1
maxZoom=3
bounds=tileBounds
}}
{{/leaflet-map}}
{
"version": "0.10.7",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.0",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {
"ember-leaflet": "3.0.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment