Git Product home page Git Product logo

gui's Introduction

GUI

UI components for G.

Build Status Coverage Status npm Version npm Download npm License

✨ Features

📦 Installation

$ npm install @antv/gui

🔨 Getting Started

import { Canvas } from '@antv/g';
import { Renderer } from '@antv/g-canvas';
import { Button } from '@antv/gui';

// create a canvas
const canvas = new Canvas({
  container: 'container',
  width: 600,
  height: 600,
  renderer: new Renderer(),
});

// create a button
const button = new Button({
  /* ... */
});

canvas.appendChild(button);

// render it
canvas.render();

📎 Components

📮 Contribution

$ git clone [email protected]:antvis/gui.git

$ cd gui

$ npm install

$ npm run dev

Then send a pull request after coding.

📄 License

MIT@AntV.

gui's People

Contributors

aarebecca avatar ai-qing-hai avatar hustcc avatar pearlwang1106 avatar pearmini avatar rainy-25ghz avatar visiky avatar xcy960815 avatar xiaoiver avatar yp0413150120 avatar zhanba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gui's Issues

[讨论] 组件 API 设计

G 的大部分 api 设计会考虑 DOM API,那我们在做 GUI 的时候,有一些 API 属性定义参考的是 DOM API 还是 React 呢?比如:

  • onClick,onChange
  • or onclick, onchange

一些现状:

组件 现象
Scrollbar image
Button image

Arc Axis 当 `label.align` 为 `tangential` 且 verticalFactor 为 -1 的时候展示有问题

这个 demo 里面,当 label.aligntangential 且 verticalFactor 为 -1 的时候展示有问题。

image

const arc = new Arc({
  style: {
    startAngle: -90,
    endAngle: 270,
    radius: 100,
    center: [150, 150],
    verticalFactor: -1,
    title: {
      content: '圆弧坐标轴',
    },
    grid: {
      items: getGridItems(arcTicks, 100, -90, 270, [150, 150]),
      lineStyle: { lineDash: [0, 0] },
    },
    ticks: arcTicks,
    label: {
      align: 'tangential',
      autoHide: true,
      autoHideTickLine: false,
    },
    subTickLine: { count: 1 },
  },
});

分类图例分页器异常

Error: Cannot find propagation path to disconnected target

  322 |    });
  323 |    this.view.style.clipPath = this.clipView;
  324 |    // 将全景图挂载到翻页器
> 325 |    this.appendChild(this.view);
  326 | 
  327 |    const [startMarker, endMarker] = this.defaultShape;
  328 |    // 初始化按钮

mark 下,之后会修

[走查] marker size 定义不一致

image

复现代码:

import { Canvas } from '@antv/g';
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
import { Marker, svg2marker } from '@antv/gui';

const renderer = new CanvasRenderer({
  enableDirtyRectangleRenderingDebug: false,
  enableAutoRendering: true,
  enableDirtyRectangleRendering: true,
});

const canvas = new Canvas({
  container: 'container',
  width: 300,
  height: 300,
  renderer,
});

// Marker.registerSymbol(
//   'star',
//   svg2marker(
//     `<svg height="512" width="512" viewport="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M480 207H308.6L256 47.9 203.4 207H32l140.2 97.9L117.6 464 256 365.4 394.4 464l-54.7-159.1L480 207zM362.6 421.2l-106.6-76-106.6 76L192 298.7 84 224h131l41-123.3L297 224h131l-108 74.6 42.6 122.6z"/></svg>`
//   )
// );

Marker.registerSymbol('star', (x, y, r) => {
  const path = [];
  for (let i = 0; i < 5; i++) {
    path.push([
      i === 0 ? 'M' : 'L',
      (Math.cos(((18 + i * 72) * Math.PI) / 180) * r) / 2 + x,
      (-Math.sin(((18 + i * 72) * Math.PI) / 180) * r) / 2 + y,
    ]);
    path.push([
      'L',
      (Math.cos(((54 + i * 72) * Math.PI) / 180) * r) / 4 + x,
      (-Math.sin(((54 + i * 72) * Math.PI) / 180) * r) / 4 + y,
    ]);
  }
  path.push(['Z']);
  return path;
});


const marker = new Marker({
  style: {
    symbol: 'star',
    x: 50,
    y: 50,
    size: 32,
    fill: 'orange',
  },
});


const marker1 = new Marker({
  style: {
    symbol: 'triangle',
    x: 150,
    y: 50,
    size: 16,
    fill: 'orange',
  },
});

canvas.appendChild(marker);
canvas.appendChild(marker1);

使用 G 提供的增强版 Text

之前 G 提供的 Text 未提供 text-overflow,导致在 GUI 里实现了一个增强版 Text 提供文本截断、装饰线等 “高级特性”。
思考了一下这样的常用功能还是应该内置,也能避免 GUI 里涉及使用 <canvas> 进行文本度量等本该渲染引擎内置的工作,也不利于服务端渲染。

antvis/G#1149

另外 text-transform 已经提供,也不需要重复实现了。
https://g-next.antv.vision/zh/docs/api/basic/text#texttransform

【axis 】axis 组件若干问题

✅ 问题1: axisLine 设置 lineWidth为 0.5 时,绘制错误

复现:https://riddle.alibaba-inc.com/riddles/e2167ac7

image

原因:G 层的 Z 命令 存在问题,暂时不需要使用闭合

✅ 问题2:axis label.style.default.textAlign 设置不生效

image

问题3: arc axis 问题

image

问题3: arc alignTick & appendTick 问题

image

问题4: 目前都不存在状态样式,有必要保留状态样式的设置么?(需要讨论)

✅ 问题5: axis arrow 问题

image

原因:G 层的 Z 命令 存在问题,暂时不使用

问题6:axis label 边界碰撞问题

image

优化之后,标签碰撞问题

image

Legend item 层级有误

SVG 渲染器下 item 跑到根节点下了,但 Canvas 正常且打印层次结构正常,应该是 G 的 bug:

截屏2023-03-02 下午6 06 16

排查了下发现是通过 appendChild 改变原父节点后,SVG DOM 元素未同步更新:
antvis/G#1302

ts-essentials dependency

Hey! 👋

I searched for the usage of ts-essentials and didn't find you're using it, however still put it in package.json

Do you mind if I remove it? Or do you plan to use it?

[走查] Switch 组件

checklist

  • 类型定义梳理
  • 细节对照
描述 调研 现状
描述文本,在 size 改变的时候,无法自适应 imageimage image

Todo list

看下 #109 的改造

  • 目前从使用上,Tag 组件在这里并不是很实用。或许是 Tag 实现有问题,可以去看下如何重构调整。
  • 相应的单测需要完善

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.