mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复 cylinder 在 mapbox 高度错误且 heightfixed 失效 (#991)
This commit is contained in:
parent
3c378fab33
commit
bca4bea08c
|
@ -88,9 +88,22 @@ void main() {
|
|||
|
||||
vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
|
||||
if(u_heightfixed < 1.0) { // 圆柱体不固定高度
|
||||
offset = project_pixel(offset);
|
||||
// offset = project_pixel(offset);
|
||||
if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {
|
||||
// P20 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减1
|
||||
offset = offset * pow(2.0, (19.0 - u_Zoom));
|
||||
}
|
||||
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
||||
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
||||
offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));
|
||||
}
|
||||
} else {// 圆柱体固定高度 ( 处理 mapbox )
|
||||
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
||||
offset *= 4.0/pow(2.0, 21.0 - u_Zoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));
|
||||
|
||||
// vec4 pos = vec4(project_pos.xy + offset, project_pixel(size.z) * u_r, 1.0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { PointLayer, Scene } from '@antv/l7';
|
||||
import { GaodeMap } from '@antv/l7-maps';
|
||||
import { GaodeMap, GaodeMapV2, Mapbox, Map } from '@antv/l7-maps';
|
||||
import * as React from 'react';
|
||||
|
||||
export default class Amapdemo_extrude extends React.Component {
|
||||
|
@ -18,15 +18,12 @@ export default class Amapdemo_extrude extends React.Component {
|
|||
pitch: 40,
|
||||
style: 'normal',
|
||||
zoom: 8,
|
||||
animateEnable: false,
|
||||
viewMode: '3D',
|
||||
}),
|
||||
});
|
||||
|
||||
this.scene = scene;
|
||||
|
||||
scene.on('loaded', () => {
|
||||
console.log('event test');
|
||||
fetch(
|
||||
'https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json',
|
||||
)
|
||||
|
@ -42,7 +39,9 @@ export default class Amapdemo_extrude extends React.Component {
|
|||
})
|
||||
.shape('cylinder')
|
||||
.size('t', function(level) {
|
||||
// return [4000, 4000, level * 4000 + 20];
|
||||
return [4, 4, level * 4 + 20];
|
||||
// return [4000, 4000, level * 4000 + 20];
|
||||
})
|
||||
.active(true)
|
||||
.color('t', [
|
||||
|
@ -57,7 +56,7 @@ export default class Amapdemo_extrude extends React.Component {
|
|||
'#A1EDB8',
|
||||
'#CEF8D6',
|
||||
])
|
||||
.animate(true)
|
||||
// .animate(true)
|
||||
// .animate({
|
||||
// enable: false,
|
||||
// // speed: 0.1,
|
||||
|
@ -65,6 +64,7 @@ export default class Amapdemo_extrude extends React.Component {
|
|||
// })
|
||||
.style({
|
||||
opacity: 1.0,
|
||||
// heightfixed: true
|
||||
});
|
||||
scene.addLayer(pointLayer);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue