Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opacity option #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ Or for Maki icons
| icon | Name of the icon | 'home' | See glyphicons or font-awesome |
| prefix | Select de icon library | 'fa' | 'fa' for font-awesome or 'glyphicon' for bootstrap 3 |
| markerColor | Color of the marker | 'blue' | Any HEX color you can find |
| iconColor | Color of the icon | 'white' | 'white', 'black' or css code (hex, rgba etc) |
| spin | Make the icon spin | false | true or false. Font-awesome required |
| iconColor | Color of the icon | 'white' | 'white', 'black' or css code (hex, rgba etc) |
| opacity | Opacity of the marker | 1 | Float between 0.0 and 1.0 |
| spin | Make the icon spin | false | true or false. Font-awesome required |
| extraClasses | Additional classes in the created <i> tag | '' | 'fa-rotate90 myclass' eller other custom configuration |


Expand Down
10 changes: 4 additions & 6 deletions dist/leaflet-vector-markers.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ Version: 0.0.6
height: 40%;
position: absolute;
right: 21px;
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: skew(150deg) rotate(-40deg);
-ms-transform: skew(150deg) rotate(-40deg);
transform: skew(150deg) rotate(-40deg);
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-ms-transform: skew(150deg) rotate(-40deg);
transform: skew(150deg) rotate(-40deg);
width: 60%;
z-index: -1; }

Expand Down
11 changes: 6 additions & 5 deletions dist/leaflet-vector-markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ return /******/ (function(modules) { // webpackBootstrap
extraDivClasses: '',
icon: 'home',
markerColor: 'blue',
opacity: 1,
iconColor: 'white',
viewBox: '0 0 32 52'
};
Expand All @@ -162,7 +163,7 @@ return /******/ (function(modules) { // webpackBootstrap
function Icon(options) {
_classCallCheck(this, Icon);

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Icon).call(this, options));
var _this = _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).call(this, options));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.


_leaflet2.default.Util.setOptions(_this, iconOptions);
_leaflet2.default.Util.setOptions(_this, options);
Expand All @@ -176,7 +177,7 @@ return /******/ (function(modules) { // webpackBootstrap
var options = this.options;
var pin_path = options.map_pin || mapPin;

div.innerHTML = '<svg width="' + options.iconSize[0] + 'px" height="' + options.iconSize[1] + 'px" viewBox="' + options.viewBox + '" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="' + pin_path + '" fill="' + options.markerColor + '"></path></svg>';
div.innerHTML = '<svg width="' + options.iconSize[0] + 'px" height="' + options.iconSize[1] + 'px" viewBox="' + options.viewBox + '" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="' + pin_path + '" fill="' + options.markerColor + '" opacity="' + options.opacity + '"></path></svg>';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.


if (options.icon) {
div.appendChild(this._createInner());
Expand Down Expand Up @@ -204,10 +205,10 @@ return /******/ (function(modules) { // webpackBootstrap
if (options.extraClasses) {
i.classList.add(options.extraClasses);
}
if (options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-') {
i.classList.add(options.icon);
} else {
if (options.prefix) {
i.classList.add(options.prefix + '-' + options.icon);
} else {
i.classList.add(options.icon);
}
if (options.spin && typeof options.spinClass === 'string') {
i.classList.add(options.spinClass);
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet-vector-markers.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions lib/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var iconOptions = {
extraDivClasses: '',
icon: 'home',
markerColor: 'blue',
opacity: 1,
iconColor: 'white',
viewBox: '0 0 32 52'
};
Expand All @@ -43,7 +44,7 @@ var Icon = function (_Leaflet$Icon) {
function Icon(options) {
_classCallCheck(this, Icon);

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Icon).call(this, options));
var _this = _possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).call(this, options));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
The 'proto' property is deprecated.


_leaflet2.default.Util.setOptions(_this, iconOptions);
_leaflet2.default.Util.setOptions(_this, options);
Expand All @@ -57,7 +58,7 @@ var Icon = function (_Leaflet$Icon) {
var options = this.options;
var pin_path = options.map_pin || mapPin;

div.innerHTML = '<svg width="' + options.iconSize[0] + 'px" height="' + options.iconSize[1] + 'px" viewBox="' + options.viewBox + '" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="' + pin_path + '" fill="' + options.markerColor + '"></path></svg>';
div.innerHTML = '<svg width="' + options.iconSize[0] + 'px" height="' + options.iconSize[1] + 'px" viewBox="' + options.viewBox + '" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="' + pin_path + '" fill="' + options.markerColor + '" opacity="' + options.opacity + '"></path></svg>';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
Identifier 'pin_path' is not in camel case.


if (options.icon) {
div.appendChild(this._createInner());
Expand Down Expand Up @@ -85,10 +86,10 @@ var Icon = function (_Leaflet$Icon) {
if (options.extraClasses) {
i.classList.add(options.extraClasses);
}
if (options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-') {
i.classList.add(options.icon);
} else {
if (options.prefix) {
i.classList.add(options.prefix + '-' + options.icon);
} else {
i.classList.add(options.icon);
}
if (options.spin && typeof options.spinClass === 'string') {
i.classList.add(options.spinClass);
Expand Down
45 changes: 0 additions & 45 deletions npm-debug.log

This file was deleted.

3 changes: 2 additions & 1 deletion src/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const iconOptions = {
extraDivClasses: '',
icon: 'home',
markerColor: 'blue',
opacity: 1,
iconColor: 'white',
viewBox: '0 0 32 52',
}
Expand All @@ -31,7 +32,7 @@ export default class Icon extends Leaflet.Icon {
const options = this.options
const pin_path = options.map_pin || mapPin

div.innerHTML = `<svg width="${options.iconSize[0]}px" height="${options.iconSize[1]}px" viewBox="${options.viewBox}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="${pin_path}" fill="${options.markerColor}"></path></svg>`
div.innerHTML = `<svg width="${options.iconSize[0]}px" height="${options.iconSize[1]}px" viewBox="${options.viewBox}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="${pin_path}" fill="${options.markerColor}" opacity="${options.opacity}"></path></svg>`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
Identifier 'pin_path' is not in camel case.
Missing semicolon.


if (options.icon) {
div.appendChild(this._createInner())
Expand Down