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

feat: 支持自定义 G 5.0 插件和配置 #2423

Merged
merged 6 commits into from
Nov 22, 2023
Merged

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented Nov 20, 2023

👀 PR includes

✨ Feature

  • New feature

📝 Description

  1. 废弃 S2 这一层的 supportCSSTransformdevicePixelRatio, 这两个属性本质是透传到 G
  2. 新增 transformCanvasConfig 支持自定义注册 G 插件和配置
import { Plugin as PluginRoughCanvasRenderer } from '@antv/g-plugin-rough-canvas-renderer';
import { Plugin as PluginA11y } from '@antv/g-plugin-a11y';

const s2Options = {
  transformCanvasConfig(renderer) {
    renderer.registerPlugin(new PluginRoughCanvasRenderer());
    renderer.registerPlugin(
      new PluginA11y({
        enableExtractingText: true,
      }),
    );

    console.log('当前已注册插件:', renderer.getPlugins(), renderer.getConfig());

    return {
      supportsCSSTransform: true,
      devicePixelRatio: 2,
      cursor: 'crosshair',
    };
  },
};

image

🖼️ Screenshot

Before After

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

移除 supportsCSSTransform, devicePixelRatio, 统一使用
transformCanvasConfig 配置

BREAKING CHANGE: 移除 devicePixelRatio 和 supportsCSSTransform
Copy link

vercel bot commented Nov 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Nov 22, 2023 9:12am

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Size Change: -68 B (0%)

Total Size: 310 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 216 kB -68 B (0%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 402 B
./packages/s2-react/dist/index.min.js 67.4 kB
./packages/s2-react/dist/style.min.css 3.99 kB
./packages/s2-vue/dist/index.min.js 20.2 kB
./packages/s2-vue/dist/style.min.css 1.98 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Nov 20, 2023

你好, @lijinke666 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。

Hello, @lijinke666 CI run failed, please click the [Details] button for detailed log information and fix it.

@github-actions github-actions bot added the 🚨 test failed 单元测试挂了 label Nov 20, 2023
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ecdc9c8) 75.77% compared to head (d7f6328) 77.85%.
Report is 211 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2423      +/-   ##
==========================================
+ Coverage   75.77%   77.85%   +2.08%     
==========================================
  Files         257      270      +13     
  Lines       11994    12039      +45     
  Branches     2464     2442      -22     
==========================================
+ Hits         9088     9373     +285     
+ Misses       1398     1164     -234     
+ Partials     1508     1502       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added the 🚨 test failed 单元测试挂了 label Nov 22, 2023
@github-actions github-actions bot removed the 🚨 test failed 单元测试挂了 label Nov 22, 2023
@lijinke666
Copy link
Member Author

Size Change: +53 kB (+16%) ⚠️

Total Size: 374 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 280 kB +53 kB (+23%) 🚨
ℹ️ View Unchanged
compressed-size-action

体积有点不对劲

@wjgogogo
Copy link
Contributor

🐂🍺

@lijinke666 lijinke666 merged commit cc6c47f into next Nov 22, 2023
9 of 10 checks passed
@lijinke666 lijinke666 deleted the feat-forward-g-options branch November 22, 2023 09:18
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.0.0-next.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-v2.0.0-next.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 pr(feature) new feature released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants