【发布时间】:2013-04-02 02:43:47
【问题描述】:
刚开始检查动力学 js。我有很多组,每个组都有一个Kinetic.Text 和一个Kinetic.Rect。
我可以通过这个提示轻松更改任何文本;
text.on('click', function(evt) {
this.setText(prompt('New Text:'));
layer.draw(); //redraw the layer containing the textfield
});
但我想根据文本更改矩形(包含文本)的高度和宽度。所以,这是我尝试过的,但这不起作用。它向我显示了提示,但不会更改文本,并且在那之后我的组变得无法点击!;
group.on('click', function(evt) {
this.get('.textbox').setText(prompt('New Text:'));
//this.get('.rectangle')....change rect's height/width here
layer.draw(); //redraw the layer containing the textfield
});
矩形和文本框是每个组中Kinteic.Text 和Kinetic.Rect 的名称。我做错了什么?
【问题讨论】:
标签: javascript canvas html5-canvas kineticjs