kineticjs - Set group width depending on content -


I want to use KineticJs, and I am writing a function that is position: absolute; For true: ..px for element group (with kineticJS), I do this:

  correct: function (dist) {this.x (250- This.width () - dist); }  

(250 is the container width) but the group element's width is 0, even if I use the group.add (image). I would like to know that there is a way for the width of the group, in this case it will be the width of the group's image. You can create a function resizing group based on the sizes of your children:

P> Example code and a demo:

Change the size of the font grouptuent (group) {var width = 0; Var height = 0; group (); (hair) (). Each (function (node) {var true = node.x () + node.width (); if (right & gt; width) {width = right;} var below = node.y () + node .height () ; If (below> height) {height = bottom;}}); Group.width (width); Group.height (height); Layer.draw (); }

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

Powerbuilder 12.1 and DataWindow in Design vs Debug and Executable/Runtime -

css3 - HTML Block Anchor element only half clickable in Chrome -