title: Center draggable div relative to cursor when the size of the div changes
body: <p>I'm writing an application with draggable fields (the divs). Before these fields are placed they are one size but then once they are picked up and being dragged they change to their "final" size (the size can change at a later time too, but they stay the dragged size until it's changed manually later). </p>
  
  <p>What I'm trying to do is center the div relative to the cursor when the div is being dragged. </p>
  
  <p>I know about the cursorAt property of draggable objects, but it's not working when you drag the object for the first time. If you drag, drop, and drag again it will center correctly.</p>
  
  <p><a href="http://jsfiddle.net/meishe91/d06r990w/" rel="nofollow">Fiddle demonstrating the issue.</a></p>
  
  <pre><code>$('div').draggable({
      start: function () {
          $(this)
              .css('height', (Math.floor((Math.random() * 250) + 100).toString() + 'px'))
              .css('width', (Math.floor((Math.random() * 250) + 100).toString() + 'px'));
  
          $(this).draggable('option', 'cursorAt', {
              top: parseInt($(this).css('height')) / 2,
              left: parseInt($(this).css('width')) / 2
          });
      }
  });
  </code></pre>
  
  <p>Obviously that's just an example, but it demonstrates the point because it will never center the div relative to the cursor. I figured that since I'm setting the CSS first that it should be doing it correctly, but it doesn't. </p>
  
  <p><a href="http://jsfiddle.net/meishe91/d06r990w/2/" rel="nofollow">I've also tried moving the changing of the size to the <code>mousedown</code> event in to make sure the CSS get's changed first (in case for some reason it wasn't...was just a way to make sure) but it still doesn't work correctly.</a> </p>
  
  <p><a href="http://jsfiddle.net/meishe91/d06r990w/1/" rel="nofollow">And I also tried calculating the new sizes first, and then using the variable to do the calculations instead of relying on the CSS values. Still didn't work.</a> </p>