【GIS】Vue、Leaflet、highlightmarker、bouncemarker
感谢:
https://github.com/brandonxiang/leaflet.marker.highlight
https://github.com/maximeh/leaflet.bouncemarker
1、导入highlightmarker库
import highlightmarker from "../lib/leaflet/leaflet.marker.highlight.js";
import "../lib/leaflet/leaflet.marker.highlight.css";
2、定制Icon
delete L.Icon.Default.prototype._getIconUrl; L.Icon.Default.mergeOptions({
iconRetinaUrl: require("../lib/leaflet/images/marker-icon-2x.png"),
iconUrl: require("../lib/leaflet/images/marker-icon.png"),
shadowUrl: require("../lib/leaflet/images/marker-shadow.png")
}); import bouncemarker from "../lib/leaflet/leaflet.bouncemarker.js";
3、使用Marker
that.markerPoint = L.marker([e.latlng.lat, e.latlng.lng], {
highlight: "permanent",
bounceOnAdd: true,
bounceOnAddOptions: { duration: 500, height: 100, loop: 2 },
bounceOnAddCallback: function() {
console.log("done");
}
}).addTo(that.mapR); that.markerPoint.on("click", function() {
console.log("click");
that.markerPoint.bounce({ duration: 500, height: 100 });
});
4、由于webpack编译过程中会删减css信息,导致开发状态有高亮效果,而发布之后没有,所以需要修改leaflet.marker.highlight.css文件,以兼容浏览器
.leaflet-marker-pane .light {
width: 200px!important;
height: 200px!important;
margin-top: -100px!important;
margin-left: -100px!important;
/*transform: translate(-50%, -50%);*/
background: transparent!important;
border: transparent!important;
} .leaflet-marker-pane .light .glow {
width: 0px;
height: 0px;
border-radius: 50%;
opacity:;
background: -webkit-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -moz-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -ms-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -o-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
/* background: -webkit-radial-gradient(rgba(254, 211, 0, 1), rgba(255, 223, 67, 0) 70%); */
position: absolute;
display: block;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
} img:hover+.light.temporary .glow {
width: 200px;
height: 200px;
opacity: 0.2;
background: -webkit-radial-gradient(rgba(254, 211, 0, 1), rgba(255, 223, 67, 0) 70%);
-webkit-transition: all 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-transition: all 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-transition: all 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-transition: all 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
} .leaflet-marker-pane .light .flare {
width: 0px;
height: 0px;
border-radius: 50%;
opacity:;
background: rgba(255, 223, 67, 0);
position: absolute;
display: block;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 1000ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
} img:hover+.light.temporary .flare {
width: 50px;
height: 50px;
opacity: 0.5;
background: rgba(254, 211, 0, 1);
-webkit-transition: all 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-transition: all 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-transition: all 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-transition: all 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: all 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
} @-webkit-keyframes highlight1 {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 200px;
height: 200px;
opacity: 0.4;
}
} @-moz-keyframes highlight1 {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 200px;
height: 200px;
opacity: 0.4;
}
} @-ms-keyframes highlight1 {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 200px;
height: 200px;
opacity: 0.4;
}
} @-o-keyframes highlight1 {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 200px;
height: 200px;
opacity: 0.4;
}
} @keyframes highlight1 {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 200px;
height: 200px;
opacity: 0.4;
}
} @-webkit-keyframes highlight {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 50px;
height: 50px;
opacity: 0.8;
}
} @-o-keyframes highlight {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 50px;
height: 50px;
opacity: 0.8;
}
} @-moz-keyframes highlight {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 50px;
height: 50px;
opacity: 0.8;
}
} @-ms-keyframes highlight {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 50px;
height: 50px;
opacity: 0.8;
}
} @keyframes highlight {
0% {
width: 0px;
height: 0px;
opacity:;
}
100% {
width: 50px;
height: 50px;
opacity: 0.8;
}
} .permanent .glow {
background: -webkit-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -moz-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -ms-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: -o-radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
background: radial-gradient(rgba(66, 186, 255, 1), rgba(255, 223, 67, 0) 70%);
-webkit-animation: highlight1 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-animation: highlight1 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-animation: highlight1 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-animation: highlight1 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation: highlight1 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
} .permanent .flare {
background: rgba(66, 186, 255, 1) !important;
-webkit-animation: highlight 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-moz-animation: highlight 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-ms-animation: highlight 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
-o-animation: highlight 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation: highlight 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
5、高亮marker之后,在删除marker时候,marker删除了,高亮的光圈没有删除,故需要修改leaflet.marker.highlight.js,增加删除高亮光圈功能,增加onRemove方式
onRemove: function (map) {
originalOnRemove.call(this, map);
L.DomUtil.remove(this._light);
},
6、效果展示
【GIS】Vue、Leaflet、highlightmarker、bouncemarker的更多相关文章
- 【GIS】Vue esri-leaflet
1.npm install esri-leaflet --save 2.引入包 import Leaflet from "leaflet"; var esri = require( ...
- 【GIS】Vue修改图层透明度
1.添加透明度控制条 <input id="slider" type="range" min="0" max="1" ...
- 【JeecgBoot】关于 jeecg-boot 的项目理解、使用心得和改进建议
工欲善其事,必先利其器. 脚手架选型 一年前,我接到为团队落地一个快速开发脚手架的任务. 在月底这节骨眼上,时间紧,任务急,有想自己撸一个脚手架的人都赶紧把这想法收起来吧!这劳民又伤身的事咱肯定是不能 ...
- 【VNC】Linux环境VNC服务安装、配置与使用
[VNC]Linux环境VNC服务安装.配置与使用 2009-06-25 15:55:31 分类: Linux 前言:作为一名DBA,在创建Oracle数据库的过程中一般要使用dbca和netc ...
- 【MySQL】Linux下MySQL 5.5、5.6和5.7的RPM、二进制和源码安装
[MySQL]Linux下MySQL 5.5.5.6和5.7的RPM.二进制和源码安装 1.1 BLOG文档结构图 1.2 前言部分 1.2.1 导读和注意事项 各位技术爱好者,看完本文后, ...
- 【转】Python基础-封装与扩展、静态方法和类方法
[转]Python基础-封装与扩展.静态方法和类方法 一.封装与扩展 封装在于明确区分内外,使得类实现者可以修改封装内的东西而不影响外部调用者的代码:而外部使用者只知道一个接口(函数),只要接口(函数 ...
- 【转】shell编程下 特殊变量、test / [ ]判断、循环、脚本排错
[转]shell编程下 特殊变量.test / [ ]判断.循环.脚本排错 第1章 shell中的特殊变量 1.1 $# $# 表示参数的个数 1.1.1 [示例]脚本内容 [root@znix ~] ...
- 【树莓派】树莓派与XBMC及Kodi、LibreELEC插件(二)
之前的相关文章参考: [树莓派]树莓派与XBMC及Kodi.LibreELEC插件(一) [树莓派]树莓派与XBMC及Kodi.LibreELEC插件(二) [树莓派]树莓派与XBMC及Kodi.Li ...
- 【树莓派】树莓派与XBMC及Kodi、LibreELEC插件(一)
网上高人多. 高手在民间,饭桶在机关. 越用树莓派,越发现这玩意儿的潜力,我想,未来我们用它,可以做很多事情. 最近在看树莓派的应用场景,看到网上有人用它做电视盒子. 参考相关文章,简单实践了一下,整 ...
随机推荐
- [原创]Eclipse Memory Analyzer tool(MAT)工个使用介绍
[原创]Eclipse Memory Analyzer tool(MAT)工个使用介绍
- perl debug
1. 进入debug模式 # perl -d ./perl_debugger.pl it prompts, DB<1> 2. 查看从第10行开始的代码. 查看函数get_pattern ...
- 使用JCOOKIES创建http cookie
jCookies,一个功能强大的操作http cookie的jquery插件,他能够让你存储任何数据类型如:字符串,数组,对象等.它通过JavaScript存储Cookies,然后通过服务器端代码如: ...
- Xcode 安装ClangFormat 插件
sudo gem install -n /usr/local/bin update_xcode_plugins 安装ClangFormat git clone https://github.com/t ...
- Installing Windows Features without Internet
To set the source file path for the sxs folder, complete these steps: Ensure you have the correct in ...
- STM32 F103 F407 F429 F767对比图
- jdbctemplate 获取数据表结构的方法&注意事项
方法一 直接查询: SqlRowSet srcSqlRowSet = srcJdbcTemplate.queryForRowSet("SELECT * FROM tablename LIMI ...
- Python实现邮件的批量发送
Python实现邮件的批量发送 1 发送文本信息 '''加密发送文本邮件''' def sendEmail(from_addr,password,to_addr,smtp_server): try: ...
- python3用BeautifulSoup用字典的方法抓取a标签内的数据
# -*- coding:utf-8 -*- #python 2.7 #XiaoDeng #http://tieba.baidu.com/p/2460150866 #标签操作 from bs4 imp ...
- APP安全测评checklist---Android
首先,你的app得先混淆:AndroidStudio 混淆打包 先来个checklist: 编号 检查项目 测评结果 1 明文传输用户名.密码和验证码等敏感信息. 2 不安全的本地存储. 3 泄漏后台 ...