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

当使用MapboxglLayer读取mapbox的style作为地图时,在倾斜地图后,再旋转地图,已经绘制的线要素会发生无规律偏移 #16

Open
flanker521 opened this issue Apr 6, 2020 · 0 comments

Comments

@flanker521
Copy link

创建一个地图,style自行替换
var map = new maptalks.Map('map', {
center: [114, 31],
zoom: 10,
baseLayer: new maptalks.MapboxglLayer('tile', {
glOptions: {
'style': 'http://ip/styles/style.json'
}
})
});
var layer = new maptalks.VectorLayer('vector', {forceRenderOnMoving: true}).addTo(map);

再加入一段线,线务必多于三个点

var start = [114, 31],
middle1 = [114, 31.05],
middle2 = [114.05, 31.05],
end = [114.05, 31.08];
var coords = [start, middle1, middle2, end]
var arrow = new maptalks.LineString(
coords,
{
'id': 'arrow',
'arrowStyle': 'classic',
'arrowPlacement': 'vertex-last'
}
) .addTo(layer);

然后倾斜地图45度角或其他倾斜角度,再旋转地图即可见效果
引入的相关库如下:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.js"></script> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.1/mapbox-gl.js'></script> <script type="text/javascript" src="https://unpkg.com/maptalks.mapboxgl/dist/maptalks.mapboxgl.min.js"></script>
@flanker521 flanker521 changed the title 当使用MapboxglLayer读取mapbox的style作为地图时,在倾斜地图后,再旋转地图,已经绘制的线要素会发生无规律便宜 当使用MapboxglLayer读取mapbox的style作为地图时,在倾斜地图后,再旋转地图,已经绘制的线要素会发生无规律偏移 Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant