drag shape without fill

﹥>﹥吖頭↗ 提交于 2019-12-13 07:58:25

问题


I am trying to create an EaselJS app that lets me drag unfilled circles around the canvas - so instead of calling beginFill when I am setting up the Shape I would call beginStroke. I am running into the problem that if I don't fill the shape, I can only drag it when I am selecting the top left corner of the shape. When the shape is filled I can drag it by selecting anywhere within the shape. Is there a way I can make the unfilled shape drag the same way as the filled shape?


回答1:


Strokes and fills are necessary in EaselJS for masks. You could however assign an other Shape as hitArea:

 var shape = new createjs.Shape();
 shape.graphics.beginFill("#000000").drawCircle(0, 0, 40);

 draggableCircle.hitArea = shape;

Keep in mind that the hitArea-Shape doesn't have to be added to the stage and thus won't be visible.



来源:https://stackoverflow.com/questions/29463306/drag-shape-without-fill

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!