最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add custom control to Fabricjs object - Stack Overflow

programmeradmin1浏览0评论

I want to to add custom control(div) to Fabric js object something like this:

I found this question but it has bug on rotation please see jsfiddle

I'm trying to find solution already few days, any suggestions are weled.

I want to to add custom control(div) to Fabric js object something like this:

I found this question but it has bug on rotation please see jsfiddle

I'm trying to find solution already few days, any suggestions are weled.

Share Improve this question edited May 23, 2017 at 12:01 CommunityBot 11 silver badge asked Nov 16, 2015 at 18:17 user525717user525717 1,6525 gold badges28 silver badges40 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 1

http://jsfiddle/86bTc/94/

var btnLeft = ((e.target.width / 2)  -10 )* cos(angle) + ((e.target.height / 2) +25) * sin(angle);
var btnTop = -((e.target.height / 2) +25 )* cos(angle) + ((e.target.width / 2) -10 ) * sin(angle);

You have to add the rotation effect to LEFT and TOP of your absolute positioned element.

I changed the positioned element with a small div, so you do not get tricked by the baseline of text that makes the 'p' element look in wrong position.

Might be that solution is good for you? Fabric js custom controls

发布评论

评论列表(0)

  1. 暂无评论