title: Kinetic.js: Get MinX, MaxX, MinY, and MaxY of rotated Kinetic.Label
body: <p>I'm trying to prevent a rotated Label from being dragged off the screen, but I cannot figure out how to get MinX, MaxX, MinY, and MaxY of the object <strong><em>in its rotated state</em></strong>. getHeight &amp; getWidth only return the values prior to the rotation.</p>
  
  <p>Here is an example illustrating the problem: </p>
  
  <pre><code> var stage = new Kinetic.Stage({
       container: 'container',
       width: window.innerWidth,
       height: window.innerHeight
   });
  
   var layer = new Kinetic.Layer();
  
   var labelLeft = new Kinetic.Label({
       x: 95,
       y: 180,
       opacity: 1.0,
       listening: true,
       draggable: true,
       rotationDeg: -45,
       text: {
           text: 'Pointing Arrow',
           fontFamily: 'Calibri',
           fontSize: 20,
           padding: 5,
           fill: 'white'
       },
       rect: {
           fill: 'blue',
           pointerDirection: 'left',
           pointerWidth: 20,
           pointerHeight: 38,
           stroke: 'black',
           strokeWidth: 2
       },
       dragBoundFunc: function (pos) {
           var newY = pos.y &lt; 50 ? 50 : pos.y;
           return {
               x: pos.x,
               y: newY
           };
       }
   });
  
   layer.add(labelLeft);
  
   // add the layer to the stage
   stage.add(layer);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/fSNnA/4/" rel="nofollow">http://jsfiddle.net/fSNnA/4/</a> </p>
  
  <p>In this example, I use dragBoundFunc to prevent the label from being dragged above y=50. but since the label is rotated, its actual highest point (MinY) has changed, and therefore you can drag it up and partially out of view.</p>
  
  <p>What I really need is a function that will return the absolute current MinX, MaxX, MinY, and MaxY - taking into account the angle of rotation and length of text will not always be the same.</p>
  
  <p>Can anyone help?</p>