How do I install freedraw for leaflet? - javascript

I need to get a leaflet freedraw plugin to work with my project. But I have no idea how to do that because there is no real tutorial about how to do it on the entire internet it seems. What are the steps to get the plugin to work with the project? I've visited the project's GitHub page but there is no tutorial either. What I need to do before I can just sit and write the code? I'm honestly trying to fix this for like two days but there's just nothing to start from including old questions from Stack Overflow with zero answers...
I've tried to install the plugin with ndm which gave me a bunch of errors with no results. Even after that, I had no idea how to connect the plugin with my project or what to do... I also tried installing the freedraw plugin with Bower which installed some files, but still, I had no idea how to get them to work with my project.
Leaflet freedraw plugin - https://github.com/Wildhoney/Leaflet.FreeDraw
Someone, please help I'm definitely not the first one waiting for full working step by step tutorial on how to get it running with leaflet.

If you don't use npm or bower you can load the plugin directly like this
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.freedraw/2.0.1/leaflet-freedraw.web.js"></script>
Invocation is as per the GitHub page
const freeDraw = new FreeDraw({ mode: FreeDraw.ALL });
map.addLayer(freeDraw);
Add options as required.

Related

VS Code module error TimelineMax from GSAP

It might sound nooby, but I do not know what's the problem and I searched for hours for an answer on the internet. I am using React with VS Code. When I want to use MagicScroll with GSAP (TimelineMax, TweenMax) to scroll to the next anchor/section direcly on my website, in the VS Code terminal appears "Module not found: Can't resolve 'TimelineMax' in 'C:\Users\marcv\webapp\src'". I have installed with npm the following: magicscroll, gsap, greensock, scrollmagic-plugins, scrollmagic-plugins-gsap. But the error doesn't go away even though I see everywhere that gsap package contains the timelinemax package. Am I right? I'm quite new in this field.
Thanks a lot for your time and if you have any question or need more information, feel free to ask.
Specifically, I want to use this: codepen.io/andystent/pen/GRgjBdJ?editors=0010.
I see at the settings that I need those 5 external scripts. So what do I need to install to have TimelineMax package?

How do I begin to use rcy:nouislider in my Meteor Application?

Sorry if this is a dumb question, I've tried to google for the answer and can't find anything definitive.
I added the following package https://atmospherejs.com/rcy/nouislider
by entering the command meteor add rcy:nouislider
I am unsure if there any more steps from here. Do I need to import the package at the top of my JS file or can I go ahead and just start using it without any other steps?
Atmosphere packages should not need to be imported. The older packaging system did that for you, and the global variable 'noUiSlider' should be available to your code for you to use like in the documentation.
If you are interested, you can download the package code and see how it's put together. Just like a Meteor project there is client and server code. See here for more details: https://guide.meteor.com/writing-atmosphere-packages.html

Custom script in electorn builder?

I'm working on an Electron application and am using electron-builder to generate a windows installer and dmg for mac.
Everything works great, I was able to set up auto update and use other features of electron-builder.
Now I need to include other files that are not part of my electron project and execute them in order to install them during the installation process (on windows).
From the electron builder docs (https://github.com/electron-userland/electron-builder/wiki/Options#NsisOptions) I found out that a custom script can be used (NSIS, which I'll have to learn). I've tried including a test script but nothing seems to happen, has anyone here tried this?
The docs don't seem detailed enough in that regard so it's been very confusing.
Thanks a lot in advance!
So after looking at different places I found out that setting win.target to nsis and perMachine to true will generate the NSIS installer.
It does work, but then sadly there are no auto updates.

cordova app stopped working after node and/or cordova update

I recently updated node.js and installed the latest version of cordova at the same time. In doing so I have some issues that I did not have before.
It says phonegap.js is depreciated and I need to replace it with cordova.js or plugins may not load
whitelist plugin warnings have started showing up:"No Content-Security-Policy meta tag found. Please add one when using the Cordova-plugin-whitelist plugin."
My plugins aren't loading on start up, but do on resuming.
The plugins is the only real issue, but I just wanted to list everything encase it gave a clue as to a solution. I have been trying for over a week to fix the plugins issue with no success. I can't just revert to the previous version as I don't know what it was.
Any ideas on possible solutions or suggestions as to what version I was likely to be using in order to have these issues now?
#Marty,
this is a common problem. You need to set your compiler to build version 3.7.0 or earlier. If you do not set the version when you build, you will get the latest version, and you get the issues you see. You can set this version on the command line when building an App from scratch.
You need to do the same with your plugins. You need to set the version with them also.
Since you are doing all this work, you may want to start adding the white-list plugin. It will be required after 4.0.0 to use the web.
In addition, you will want to start a move to NPM as the source of your plugins.
This FAQ will help
Top Mistakes by Developers new to Cordova/Phonegap
Read
#6 - Not setting the "phonegap version" for your compiler
#7 - Not setting "version" for you plugins
#10 - Not adding the new "white-list" and "white-list plugin" parameters in config.xml.
#11 - You need to get your plugins from NPM now.

Adding cordova to existing angular-lungo template

I am trying to figure out how I would go about adding cordova to my project which has angular.js and lungo.js included in it. Here's the error I get :
Error: Current working directory is not a Cordova-based project.
How would I make it a Cordova project?
I also tried the other way around. That was : By creating a cordova project first, then adding angular.js and lungo.js in it. I'm using grunt to init the scaffold template.
Here's the error:
Philippes-MacBook-Pro:hello Phil$ grunt-init lungo-angular-bridge
Running "init:lungo-angular-bridge" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.
Warning: Existing files may be overwritten! Use --force to continue.
Aborted due to warnings.
Now, I'm not sure how I could make cordova, angular.js, lungo.js all be included correctly.
Any help would be appreciated.
Thank you,
Phil.
First thing I would check is if the .cordova file is being created.
If not, try running this command from the repository: cordova create

Categories