KineticJs group.setSize(300,300)不工作 [英] KineticJs group.setSize(300,300) not working

查看:132
本文介绍了KineticJs group.setSize(300,300)不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改动力学小组的大小。但它给出了JavaScript错误消息。

I am trying to change size of kinetic group. but it gives JavaScript error message.

在kinetic js文档中它的写入比setSize工作与组节点

in kinetic js document its written than setSize works with group nodes

推荐答案

我认为文档在这方面有点过时。组没有drawFunc,因此它们没有宽度或高度。如果他们有做宽度和高度,可以创建剪辑组,这将是很好的。但是,现在,组只是用于定义其中包含的对象的相对x和y起始坐标。这使得一次移动几个对象(拖动,moveTo,事件处理程序等等),但这是关于它。

I think the documents are a bit outdated in that respect. Groups do not have a drawFunc so they do not have a width or height. If they ever do get width and height, it will be possible to create clipped groups, which will be nice. However, as they are now, groups are simply used to define a relative x and y starting coordinate for objects contained within them. This makes moving several objects at once possible (dragging, moveTo, event handlers, etc...), but that's about it.

JsFiddle请求

var group = new Kinetic.Group({
    x: 220,
    y: 40,
    draggable: true
});

只要让您的群组可拖曳,并将您的物件加入群组即可。

Just make your group draggable and add your objects to the group.

这篇关于KineticJs group.setSize(300,300)不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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