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

移动端微信浏览器漂浮地图板块不显示相关layer #2615

Open
CanonLs opened this issue Sep 13, 2024 · 3 comments
Open

移动端微信浏览器漂浮地图板块不显示相关layer #2615

CanonLs opened this issue Sep 13, 2024 · 3 comments
Assignees

Comments

@CanonLs
Copy link

CanonLs commented Sep 13, 2024

问题描述

问题见Title 想实现漂浮地图板块 ,但是两台手机 ,微信版本相同,但是iOS版本不同 一个为iOS16.3.1 完全不显示layer 一个为iOS17.4 显示正常
代码技术栈为 react+vite+ts 没有任何其他功能代码,只是最基础的官网案例

import { useState, useEffect } from 'react'
import './App.css'
import { LineLayer, PointLayer, PolygonLayer, Scene } from '@antv/l7';
import type { LarkMapProps } from '@antv/larkmap';
import { LarkMap, useScene } from '@antv/larkmap';

const config: LarkMapProps = {
  mapType: 'Gaode',
  mapOptions: {
    style: 'light',
    center: [120.210792, 30.246026],
    zoom: 5,
    token: 'b311048a9319f4c449a6406ab9f14a2d',
  },
};

const ChildComponent = () => {
  const scene = useScene();

  useEffect(() => {
    scene.setMapStyle('dark');
    let lineDown: any, lineUp: any, textLayer: any;

    fetch('https://gw.alipayobjects.com/os/bmw-prod/ecd1aaac-44c0-4232-b66c-c0ced76d5c7d.json')
      .then((res) => res.json())
      .then((data) => {

        const texts: any = [];

        data.features.map((option: any) => {
          const { name, center } = option.properties;
          const [lng, lat] = center;
          texts.push({ name, lng, lat });
          return '';
        });

        textLayer = new PointLayer({ zIndex: 2 })
          .source(texts, {
            parser: {
              type: 'json',
              x: 'lng',
              y: 'lat',
            },
          })
          .shape('name', 'text')
          .size(14)
          .color('#0ff')
          .style({
            textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
            spacing: 2, // 字符间距
            padding: [1, 1], // 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
            stroke: '#0ff', // 描边颜色
            strokeWidth: 0.2, // 描边宽度
            raisingHeight: 200000 + 150000 + 10000,
            textAllowOverlap: true,
          });
        scene.addLayer(textLayer);

        lineDown = new LineLayer().source(data).shape('line').color('#0DCCFF').size(1).style({
          raisingHeight: 200000,
        });

        lineUp = new LineLayer({ zIndex: 1 })
          .source(data)
          .shape('line')
          .color('#0DCCFF')
          .size(1)
          .style({
            raisingHeight: 200000 + 150000,
          });

        scene.addLayer(lineDown);
        scene.addLayer(lineUp);
        return '';
      });

    fetch('https://gw.alipayobjects.com/os/bmw-prod/d434cac3-124e-4922-8eed-ccde01674cd3.json')
      .then((res) => res.json())
      .then((data) => {
        const lineLayer = new LineLayer().source(data).shape('wall').size(150000).style({
          heightfixed: true,
          opacity: 0.6,
          sourceColor: '#0DCCFF',
          targetColor: 'rbga(255,255,255, 0)',
        });
        scene.addLayer(lineLayer);

        const provincelayer = new PolygonLayer({})
          .source(data)
          .size(150000)
          .shape('extrude')
          .color('#0DCCFF')
          .active({
            color: 'rgb(100,230,255)',
          })
          .style({
            heightfixed: true,
            pickLight: true,
            raisingHeight: 200000,
            opacity: 0.8,
          });

        scene.addLayer(provincelayer);

        provincelayer.on('mousemove', () => {
          provincelayer.style({
            raisingHeight: 200000 + 100000,
          });
          lineDown.style({
            raisingHeight: 200000 + 100000,
          });
          lineUp.style({
            raisingHeight: 200000 + 150000 + 100000,
          });
          textLayer.style({
            raisingHeight: 200000 + 150000 + 10000 + 100000,
          });
        });

        provincelayer.on('unmousemove', () => {
          provincelayer.style({
            raisingHeight: 200000,
          });
          lineDown.style({
            raisingHeight: 200000,
          });
          lineUp.style({
            raisingHeight: 200000 + 150000,
          });
          textLayer.style({
            raisingHeight: 200000 + 150000 + 10000,
          });
        });
        return '';
      });
  }, []);
  return null;
};

function App() {
  return (
    <LarkMap {...config} style={{ height: '300px' }}>
      <ChildComponent></ChildComponent>
    </LarkMap>
  )
}
export default App

重现链接

No response

重现步骤

No response

预期行为

我希望不同iOS版本都正常显示效果,but并没有

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

2ed55ad543714497a2ff6db55b055288
4df557da82b27eef5420540e7602fb1f
显示正常的是iOS17.4 不正常的是iOS16.3.1

补充说明(可选)

如果是我代码问题麻烦大佬指点一下

Copy link
Contributor

hi @CanonLs, welcome!

Copy link
Contributor

Hi @CanonLs, Please star this repo if you find it useful! Thanks ⭐!
你好~ @CanonLs 🌟 如果这个仓库对你有帮助,可以给我们点个star支持一下~你的支持对我们来说是最大的鼓励,感谢你的支持与点赞 🌟

@lvisei
Copy link
Member

lvisei commented Sep 19, 2024

切换 renderer 为 regl 试试

const config: LarkMapProps = {
  mapType: 'Gaode',
  mapOptions: {
    style: 'light',
    center: [120.210792, 30.246026],
    zoom: 5,
    token: 'b311048a9319f4c449a6406ab9f14a2d',
  },
renderer: 'regl'
};

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

3 participants