感谢:

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的更多相关文章

  1. 【GIS】Vue esri-leaflet

    1.npm install esri-leaflet --save 2.引入包 import Leaflet from "leaflet"; var esri = require( ...

  2. 【GIS】Vue修改图层透明度

    1.添加透明度控制条 <input id="slider" type="range" min="0" max="1" ...

  3. 【JeecgBoot】关于 jeecg-boot 的项目理解、使用心得和改进建议

    工欲善其事,必先利其器. 脚手架选型 一年前,我接到为团队落地一个快速开发脚手架的任务. 在月底这节骨眼上,时间紧,任务急,有想自己撸一个脚手架的人都赶紧把这想法收起来吧!这劳民又伤身的事咱肯定是不能 ...

  4. 【VNC】Linux环境VNC服务安装、配置与使用

     [VNC]Linux环境VNC服务安装.配置与使用 2009-06-25 15:55:31 分类: Linux   前言:作为一名DBA,在创建Oracle数据库的过程中一般要使用dbca和netc ...

  5. 【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  导读和注意事项 各位技术爱好者,看完本文后, ...

  6. 【转】Python基础-封装与扩展、静态方法和类方法

    [转]Python基础-封装与扩展.静态方法和类方法 一.封装与扩展 封装在于明确区分内外,使得类实现者可以修改封装内的东西而不影响外部调用者的代码:而外部使用者只知道一个接口(函数),只要接口(函数 ...

  7. 【转】shell编程下 特殊变量、test / [ ]判断、循环、脚本排错

    [转]shell编程下 特殊变量.test / [ ]判断.循环.脚本排错 第1章 shell中的特殊变量 1.1 $# $# 表示参数的个数 1.1.1 [示例]脚本内容 [root@znix ~] ...

  8. 【树莓派】树莓派与XBMC及Kodi、LibreELEC插件(二)

    之前的相关文章参考: [树莓派]树莓派与XBMC及Kodi.LibreELEC插件(一) [树莓派]树莓派与XBMC及Kodi.LibreELEC插件(二) [树莓派]树莓派与XBMC及Kodi.Li ...

  9. 【树莓派】树莓派与XBMC及Kodi、LibreELEC插件(一)

    网上高人多. 高手在民间,饭桶在机关. 越用树莓派,越发现这玩意儿的潜力,我想,未来我们用它,可以做很多事情. 最近在看树莓派的应用场景,看到网上有人用它做电视盒子. 参考相关文章,简单实践了一下,整 ...

随机推荐

  1. ORACLE中的字符串替换 replce、regexp_replace 和 translate

    一.语法 replace(str_source,str1,str2)  把 str_source 中 str1 字符串替换为 str2 字符串,当 str2 为 null 或'' 时,与下个作用相同 ...

  2. Delphi识别读取验证码

    unit OCR; interface uses Windows, SysUtils, Graphics, Classes, PNGImage, GIFImage, JPEG, Math, Asphy ...

  3. 常见爬虫/BOT 对抗技术简介(二)

    上一篇文章分别从网络协议,Robots文件,JS渲染,行为分析等多方面讲了些“反爬虫”,“反-反爬虫”技术. 点击查看:<常见爬虫/BOT 对抗技术简介(一)> 本文将主要介绍各种IP地址 ...

  4. 移动端适配方案 flexible.js

    前言 移动端适配一直以来都是前端开发中不可或缺的重要组成部分,如果没有了它,那么你做出来的页面极有可能会出现各种意外(写出来的页面与设计稿之间的差别).所有我们得找到一种相对来说让人比较满意的解决方案 ...

  5. nginx多站路由配置tomcat

    server { listen 80; server_name 1.goal.cn; index index index.html index.htm index.jsp; root /www/ser ...

  6. Linux性能分析流程图

  7. 树莓派3中安装JDK

    一.简介 树莓派3(Raspbian系统,下载地址:https://www.raspberrypi.org/downloads/raspbian/),安装JDK8,直接运行:apt-get insta ...

  8. ios中输入框的父类--文本框,DataPick,pickerview

    父控制器 #import <UIKit/UIKit.h> #import "ScrollViewExt.h" @interface BaseKeyBoardCtrl : ...

  9. Swap 分区的2种方式 详解与例子

    安装完Linux系统后,swap分区太小怎么办,怎么可以扩大Swap分区呢?有两个办法,一个是从新建立swap分区,一个是增加swap分区.下面介绍这两种方法: 第一您必须有root权限,过程中一定要 ...

  10. Ext4 ReiserFS Btrfs 等7种文件系统性能比拼

    2009年02月04日     为了满足广大群众的热切需求,今天做了 Ext2.Ext3.Ext4.XFS.JFS.ReiserFS 和 Btrfs 的全面性能测试,对比结果如下:     本次测试所 ...