Skip to content

🐛移动端缩放问题 #3251

@wordStart

Description

@wordStart

🏷 S2 Version / S2 版本

Package Version
@antv/s2
@antv/s2-react
@antv/s2-react-components

💻 Sheet Type / 表格类型

  • PivotSheet
  • TableSheet
  • PivotChartSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Describe the bug / 问题描述

表格在移动端数据量大,有滚动条的时候,此时进行缩放,缩放不了,当没有滚动条的时候可以,请问是框架不支持有滚动条进行缩放的功能么?

⌨️ Code Snapshots / 代码片段

<script setup> import { TableSheet, S2Event } from '@antv/s2'; import { onMounted } from 'vue'; function generateRawData() { const res = []; for (let n = 0; n < 100; n++) { res.push({ province: `p${n}`, city: `c${n}`, type: `type${n}`, subType: `subType${n}`, number: n, }); } return res; } const s2DataConfig = { fields: { rows: ['type', 'subType'], columns: ['province', 'city'], values: ['number'], }, data: generateRawData(), }; const s2Options = { width: window.innerWidth, height: 400, }; let s2; async function bootstrap() { const container = document.getElementById('s2-container'); s2 = new TableSheet(container, s2DataConfig, s2Options); s2.on(S2Event.GLOBAL_SCROLL, () => { const { scrollTargetMaxOffset } = s2.facet.vScrollBar; if ( s2.facet.isScrollToTop(0) || s2.facet.isScrollToBottom(scrollTargetMaxOffset) ) { container.style['touch-action'] = 'auto'; } else { container.style['touch-action'] = 'none'; } }); await s2.render(); } onMounted(() => { bootstrap(); const container = document.getElementById('s2-container'); let startY; container.addEventListener('touchstart', (e) => { startY = e.touches[0].clientY; const targetName = e.target.tagName; if (targetName === 'CANVAS') { container.style['touch-action'] = 'none'; } }); container.addEventListener('touchmove', (e) => { const moveY = e.touches[0].clientY; const { scrollTargetMaxOffset } = s2.facet.vScrollBar; if (moveY > startY) { if (s2.facet.isScrollToTop(0)) { container.style['touch-action'] = 'auto'; } else { container.style['touch-action'] = 'none'; } } if (moveY < startY) { if (s2.facet.isScrollToBottom(scrollTargetMaxOffset)) { container.style['touch-action'] = 'auto'; } else { container.style['touch-action'] = 'none'; } } }); container.addEventListener('touchend', () => { startY = 0; container.style['touch-action'] = 'auto'; }); }); </script> <style> * { margin: 0; padding: 0; } .container { width: 100%; height: 2000px; background-color: skyblue; } #s2-container { position: absolute; width: 100%; height: 400px; top: 200px; left: 0; } </style>

🔗 Reproduction link / 复现链接

No response

📋 Steps to Reproduce the Bug or Issue / 重现步骤

滚动表格后,进行缩放,缩放事件无法生效

😊 Expected Behavior / 期望行为

单指的时候滚动,缩放手势的时候正常缩放

😅 Current Behavior / 当前行为

No response

💻 OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

🌏 Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions