paperjs pointtext onhover选择并调整大小 [英] paperjs pointtext onhover select and resize

查看:310
本文介绍了paperjs pointtext onhover选择并调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用paperjs在画布上添加点文本.我能够在画布上创建点文本,但需要处理文本的拖动和调整大小.

I am trying to add pointtext on canvas using paperjs. i am able to create pointtext on canvas but need to handle drag and resize of text.

scope.drawText = function () {
               var pointTextLocation = new p.Point(100,100);
                var myText = new p.PointText(pointTextLocation);
                myText.fillColor = 'red';
                myText.fontSize= 25;
                myText.content = 'Sample Text';
            };

是否可以使用paperjs在屏幕下方进行操作.

is it possible to do like below screen using paperjs.

我在Google上找不到任何地方.请建议该怎么做?

I didn't find anywhere on google. Please suggest how to do this?

推荐答案

可以(使用Item.scaling),但是您必须自己编写缩放框的代码(通过使用与鼠标和键盘事件交互的常规形状绘制缩放框) .这个手工制作的缩放框将控制您的PointText.scalingPointText.rotation属性.

It is possible (using Item.scaling) but you will have to code the scaling box yourself (by drawing it with regular shapes interacting with mouse and keyboard events). This hand made scaling box will control your PointText.scaling and PointText.rotation properties.

缩放框的编码并不简单,也不难,而且我很遗憾地注意到,这经常是一个非常常见的问题,尚无标准解决方案(实现这种缩放框的解决方案太多) ),据我所知,尚没有可依赖的良好代码段.

The scaling box is not simple to code, neither hard, and I am very sorry to notice that, as often, this is an extremely frequent problem which does not have a standard solution yet (too many solutions to implement such scaling box), and to my knowledge there are no good code snippet to rely on yet.

这篇关于paperjs pointtext onhover选择并调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆