function (rect, m, style, flipH, flipV)
	{
		var d = mxUtils.getValue(style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
		flipH = (flipH != null) ? flipH : mxUtils.getValue(style, mxConstants.STYLE_FLIPH, false);
		flipV = (flipV != null) ? flipV : mxUtils.getValue(style, mxConstants.STYLE_FLIPV, false);

		m.x = Math.round(Math.max(0, Math.min(rect.width, m.x)));
		m.y = Math.round(Math.max(0, Math.min(rect.height, m.y)));
		m.width = Math.round(Math.max(0, Math.min(rect.width, m.width)));
		m.height = Math.round(Math.max(0, Math.min(rect.height, m.height)));
		
		if ((flipV && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
			(flipH && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
		{
			var tmp = m.x;
			m.x = m.width;
			m.width = tmp;
		}
			
		if ((flipH && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
			(flipV && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
		{
			var tmp = m.y;
			m.y = m.height;
			m.height = tmp;
		}
		
		var m2 = mxRectangle.fromRectangle(m);
		
		if (d == mxConstants.DIRECTION_SOUTH)
		{
			m2.y = m.x;
			m2.x = m.height;
			m2.width = m.y;
			m2.height = m.width;
		}
		else if (d == mxConstants.DIRECTION_WEST)
		{
			m2.y = m.height;
			m2.x = m.width;
			m2.width = m.x;
			m2.height = m.y;
		}
		else if (d == mxConstants.DIRECTION_NORTH)
		{
			m2.y = m.width;
			m2.x = m.y;
			m2.width = m.height;
			m2.height = m.x;
		}
		
		return new mxRectangle(rect.x + m2.x, rect.y + m2.y, rect.width - m2.width - m2.x, rect.height - m2.height - m2.y);
	}
function (rect, m, style, flipH, flipV)
	{
		var d = mxUtils.getValue(style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
		flipH = (flipH != null) ? flipH : mxUtils.getValue(style, mxConstants.STYLE_FLIPH, false);
		flipV = (flipV != null) ? flipV : mxUtils.getValue(style, mxConstants.STYLE_FLIPV, false);

		m.x = Math.round(Math.max(0, Math.min(rect.width, m.x)));
		m.y = Math.round(Math.max(0, Math.min(rect.height, m.y)));
		m.width = Math.round(Math.max(0, Math.min(rect.width, m.width)));
		m.height = Math.round(Math.max(0, Math.min(rect.height, m.height)));
		
		if ((flipV && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
			(flipH && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
		{
			var tmp = m.x;
			m.x = m.width;
			m.width = tmp;
		}
			
		if ((flipH && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
			(flipV && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
		{
			var tmp = m.y;
			m.y = m.height;
			m.height = tmp;
		}
		
		var m2 = mxRectangle.fromRectangle(m);
		
		if (d == mxConstants.DIRECTION_SOUTH)
		{
			m2.y = m.x;
			m2.x = m.height;
			m2.width = m.y;
			m2.height = m.width;
		}
		else if (d == mxConstants.DIRECTION_WEST)
		{
			m2.y = m.height;
			m2.x = m.width;
			m2.width = m.x;
			m2.height = m.y;
		}
		else if (d == mxConstants.DIRECTION_NORTH)
		{
			m2.y = m.width;
			m2.x = m.y;
			m2.width = m.height;
			m2.height = m.x;
		}
		
		return new mxRectangle(rect.x + m2.x, rect.y + m2.y, rect.width - m2.width - m2.x, rect.height - m2.height - m2.y);
	}
function ( rect , m , style , flipH , flipV ) { var d = mxUtils . getValue ( style , mxConstants . STYLE_DIRECTION , mxConstants . DIRECTION_EAST ) ; flipH = ( flipH != null ) ? flipH : mxUtils . getValue ( style , mxConstants . STYLE_FLIPH , false ) ; flipV = ( flipV != null ) ? flipV : mxUtils . getValue ( style , mxConstants . STYLE_FLIPV , false ) ; m . x = Math . round ( Math . max ( 0 , Math . min ( rect . width , m . x ) ) ) ; m . y = Math . round ( Math . max ( 0 , Math . min ( rect . height , m . y ) ) ) ; m . width = Math . round ( Math . max ( 0 , Math . min ( rect . width , m . width ) ) ) ; m . height = Math . round ( Math . max ( 0 , Math . min ( rect . height , m . height ) ) ) ; if ( ( flipV && ( d == mxConstants . DIRECTION_SOUTH || d == mxConstants . DIRECTION_NORTH ) ) || ( flipH && ( d == mxConstants . DIRECTION_EAST || d == mxConstants . DIRECTION_WEST ) ) ) { var tmp = m . x ; m . x = m . width ; m . width = tmp ; } if ( ( flipH && ( d == mxConstants . DIRECTION_SOUTH || d == mxConstants . DIRECTION_NORTH ) ) || ( flipV && ( d == mxConstants . DIRECTION_EAST || d == mxConstants . DIRECTION_WEST ) ) ) { var tmp = m . y ; m . y = m . height ; m . height = tmp ; } var m2 = mxRectangle . fromRectangle ( m ) ; if ( d == mxConstants . DIRECTION_SOUTH ) { m2 . y = m . x ; m2 . x = m . height ; m2 . width = m . y ; m2 . height = m . width ; } else if ( d == mxConstants . DIRECTION_WEST ) { m2 . y = m . height ; m2 . x = m . width ; m2 . width = m . x ; m2 . height = m . y ; } else if ( d == mxConstants . DIRECTION_NORTH ) { m2 . y = m . width ; m2 . x = m . y ; m2 . width = m . height ; m2 . height = m . x ; } return new mxRectangle ( rect . x + m2 . x , rect . y + m2 . y , rect . width - m2 . width - m2 . x , rect . height - m2 . height - m2 . y ) ; }
Function: getDirectedBounds

Adds the given margins to the given rectangle and rotates and flips the
rectangle according to the respective styles in style.
Function : getDirectedBounds
Updates the bounds of the given rectangle with the given style