Comments (4)
ellipseo?
from zrender.
就是我自己写的那个 画椭圆的方法。
/代码在这里***********/
// JavaScript Document
define(
function(require) {
function EllipseO() {
this.type = 'ellipseo';
}
EllipseO.prototype = {
/**
* 创建圆形路径
* @param {Context2D} ctx Canvas 2D上下文
* @param {Object} style 样式
*/
buildPath : function(ctx, style) {
ctx.font = '14px sans-serif';
//BezierEllipse2(ctx, 33,21,30,18);
BezierEllipse2(ctx, style.x, style.y, style.a, style.b);
function BezierEllipse2(ctx, x, y, a, b)
{
var k = .5522848,
ox = a * k, // 水平控制点偏移量
oy = b * k; // 垂直控制点偏移量
ctx.lineWidth = 3;
//从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
ctx.moveTo(x - a, y);
ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
}
return;
},
drift : function(e, dx, dy) {
e.style.x += dx;
e.style.y += dy;
},
isCover : function(e, x, y) {
if (x >= (e.style.x - e.style.a / 2 - 10)&& x <= (e.style.x + e.style.a / 2 + 10)&& (y >= e.style.y - e.style.b / 2 - 10)&& (y <= (e.style.y + e.style.b / 2 + 10))) {
return true;
}
return false;
}
};
var base = require('./base');
base.derive(EllipseO);
var shape = require('../shape');
shape.define('ellipseo', new EllipseO());
return EllipseO;
}
);
from zrender.
要把getRect方法实现,否则文字不知道定位在什么地方
from zrender.
噢 3Q.....
from zrender.
Related Issues (20)
- 两个非闭合线性图形,每个都有多个线段组成,且两个线段数量不固定,怎么求这两个图形的闭合区域 HOT 1
- 对于svg渲染器,有没有内置的方法将dom转化为zrenderJSON格式
- zrender更改坐标系的问题
- animator.js bug when building vite HOT 1
- Bug: uniapp 环境打包 h5。会注入 wx 全局变量。导致zrender 判断认为微信环境,从而引起echarts 功能异常 HOT 3
- 如何使用zrender绘制Canvas中的ellipse(椭圆弧)
- dispose/mouseup races cause NPE in Handler.isOutsideBoundary() HOT 1
- TS报错了 HOT 1
- [Feature] Support rotation relative to a point other than the origin
- 鼠标从元素上直接移出画布时,从鼠标移出位置进入画布并hover元素时,没有触发元素的mouseover事件。 HOT 3
- 文档问题 HOT 1
- 网络安全漏洞修复
- 网络安全漏洞修复
- 元素拖动后,如果获取新的x,y坐标,而不是position里面的
- 元素上的dragstart事件有问题 HOT 1
- 在触屏设备中,('mouseover')空白处(即无目标区域)是无法触发鼠标事件,click事件是可以触发的
- [vite:reporter] chunk.moduleIds is not iterable
- 导入报错 HOT 2
- SSR broken when Navigator object is defined. Node JS 21.
- decomposeTransform函数调用时parent.invTransform可能为null
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zrender.