Comments (7)
The best way would be to add that leaflet plugin to ember-leaflet.
Maybe @ForSpareParts has some helpful info on that.
from ember-leaflet.
First off: Ember-leaflet is such a great extension! Thank you so much for your hard work!
@bimabima - I need to work with leaflet.draw too. Eventually I want to try and develop actual modules for it and package it as an extension, but for now I have just extended leaflet-map
and added the options draw
and editable
to leafletOptions
like this:
import Ember from 'ember';
import LeafletMap from 'ember-leaflet/components/leaflet-map';
/* global L */
export default LeafletMap.extend({
L,
leafletOptions: ['draw','editable']
...
and then when you instantiate a map in your hbs. document you can add these options
{{leaflet-map
drawControl=true
editable=true
}}
if you want to listen for draw events you can do something like this (for now) manually
listenForDrawEvents: function(){
const self = this;
this._layer.on('draw:drawstop', function (e) {
self.sendAction('drawingFinishedAction')
});
}.on('didRender)
and
{{leaflet-map
drawControl=true
editable=true
drawingFinishedAction='handleDrawingFinishedAction'
}}
hopefully this isn't too hacky :)
from ember-leaflet.
@localyost Any chance you have a small example project?
from ember-leaflet.
when you say you extend leaflet-map, which file do you edit to do so? app/components/leaflet-map.js ?
what version of ember are you using?
Thanks!
from ember-leaflet.
Sorry for the spam...I think I've got it, but now the drawng buttons don't have symbols/icons in them. Ideas?
from ember-leaflet.
Hey, no problem :)
I'm using Ember 2.4
I don't have the project in front of me, but if I remember correctly I installed it with bower and in ember-cli-build.js
compiled the source + css
app.import('bower_components/leaflet.draw/dist/leaflet.draw.js');
app.import('bower_components/leaflet.draw/dist/leaflet.draw.css');
and then added the image sprites like this:
app.import('bower_components/leaflet.draw/dist/images/spritesheet.png', {destDir: 'assets/images'});
I'll check tomorrow.
If it's not loading the images, then check in the console where it's trying to pull them from. You should get a 404, and, as always kill your cache :)
from ember-leaflet.
Thanks. That's exactly where I just ended up.
from ember-leaflet.
Related Issues (20)
- Uncaught Error: Could not find module `ember-get-config` imported from `(require)` HOT 8
- Options to geojson not passed HOT 2
- [docs] links/version HOT 2
- Deprecated use of `assign`
- Issue going from v.4.1.1 to 5.0.0. leafletProperties is removed from BaseLayer. HOT 1
- NPE: TypeError: this.L.latLng is not a function in fastboot HOT 1
- Deprecation - ensure-safe-component.string HOT 4
- Error on cleanup
- Breaking changes using leaflet `1.8.0` HOT 3
- Uncaught Error: Assertion Failed: The `element` helper polyfill encountered an unexpected error HOT 2
- Dynamically setting bounds errors asynchronously in test HOT 1
- Help needed with an Embroider error HOT 2
- Ember 5.x+ Support HOT 2
- FastBoot issue
- Adding custom options to Wms-Tile? HOT 3
- Example of how to use divIcon HOT 4
- Documentatiojn for @popupOpen? HOT 1
- Initially set bounds on set of points
- v2 addon version?
- undeclared dependency on @ember/string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-leaflet.