Skip to content

marker闪烁事件 #2340

Open
Open
@Wu-zy1101

Description

@Wu-zy1101

maptalks's version and what browser you use?

1.0.0-rc.33
Google Chrome
Issue description

marker添加闪烁事件之后,切换浏览器标签,在切换回来。marker会隐藏

Please provide a reproduction URL (on any jsfiddle like site)

QQ图片20240527103546
微信图片_20240527103808

<script type="text/javascript" src="https://unpkg.com/maptalks/dist/maptalks.min.js"></script>
Flash

html, body {
margin:0px;
height:100%;
width:100%
}
.container {
width:100%;
height:100%
}
.pane {
background:#34495e;
line-height:28px;
color:#fff;
z-index:10;
position:absolute;
top:20px;
right:20px
}
.pane a {
display:block;
color:#fff;
text-align:left;
padding:0 10px;
min-width:28px;
min-height:28px;
float:left
}

var map = new maptalks.Map('map', {
center: [-0.113049, 51.498568],
zoom: 14,
baseLayer: new maptalks.TileLayer('base', {
urlTemplate: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c', 'd'],
attribution: '© OpenStreetMap contributors, © CARTO '
})
});

var marker = new maptalks.Marker(
map.getCenter(), {
symbol: {
'textFaceName': 'sans-serif',
'textName': 'FLASH\nME',
'textFill': '#34495e',
'textSize': 40,
'textHaloColor': 'white',
'textHaloRadius': 8
}
}
);

new maptalks.VectorLayer('vector', marker).addTo(map);

function flash() {
marker.flash(
200, //flash interval in ms
5, // count
)
}
setInterval(() => {
flash()
}, 1000 * 10);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions