src/main/java/com/mxgraph/swing/mxGraphComponent.java
protected void extendComponent(Rectangle rect)
		{
			int right = rect.x + rect.width;
			int bottom = rect.y + rect.height;

			Dimension d = new Dimension(getPreferredSize());
			Dimension sp = getScaledPreferredSizeForGraph();
			mxRectangle min = graph.getMinimumGraphSize();
			double scale = graph.getView().getScale();
			boolean update = false;

			if (rect.x < 0)
			{
				translate.x = Math.max(translate.x, Math.max(0, -rect.x));
				d.width = sp.width;

				if (min != null)
				{
					d.width = (int) Math.max(d.width,
							Math.round(min.getWidth() * scale));
				}

				d.width += translate.x;
				update = true;
			}
			else if (right > getWidth())
			{
				d.width = Math.max(right, getWidth());
				update = true;
			}

			if (rect.y < 0)
			{
				translate.y = Math.max(translate.y, Math.max(0, -rect.y));
				d.height = sp.height;

				if (min != null)
				{
					d.height = (int) Math.max(d.height,
							Math.round(min.getHeight() * scale));
				}

				d.height += translate.y;
				update = true;
			}
			else if (bottom > getHeight())
			{
				d.height = Math.max(bottom, getHeight());
				update = true;
			}

			if (update)
			{
				setPreferredSize(d);
				setMinimumSize(d);
				revalidate();
			}
		}
/**
		 * Implements extension of the component in all directions. For
		 * extension below the origin (into negative space) the translate will
		 * temporaly be used and reset with the next mouse released event.
		 */
Implements extension of the component in all directions. For
extension below the origin (into negative space) the translate will
temporaly be used and reset with the next mouse released event.
Implements extension of the component in all directions . For extension below the origin ( into negative space ) the translate will temporaly be used and reset with the next mouse released event .
protected void extendComponent(Rectangle rect)
		{
			int right = rect.x + rect.width;
			int bottom = rect.y + rect.height;
			Dimension d = new Dimension(getPreferredSize());
			Dimension sp = getScaledPreferredSizeForGraph();
			mxRectangle min = graph.getMinimumGraphSize();
			double scale = graph.getView().getScale();
			boolean update = false;
			if (rect.x < 0)
			{
				translate.x = Math.max(translate.x, Math.max(0, -rect.x));
				d.width = sp.width;
				if (min != null)
				{
					d.width = (int) Math.max(d.width,
							Math.round(min.getWidth() * scale));
				}
				d.width += translate.x;
				update = true;
			}
			else if (right > getWidth())
			{
				d.width = Math.max(right, getWidth());
				update = true;
			}
			if (rect.y < 0)
			{
				translate.y = Math.max(translate.y, Math.max(0, -rect.y));
				d.height = sp.height;
				if (min != null)
				{
					d.height = (int) Math.max(d.height,
							Math.round(min.getHeight() * scale));
				}
				d.height += translate.y;
				update = true;
			}
			else if (bottom > getHeight())
			{
				d.height = Math.max(bottom, getHeight());
				update = true;
			}
			if (update)
			{
				setPreferredSize(d);
				setMinimumSize(d);
				revalidate();
			}
		}
protected void extendComponent ( Rectangle rect ) { int right = rect . x + rect . width ; int bottom = rect . y + rect . height ; Dimension d = new Dimension ( getPreferredSize ( ) ) ; Dimension sp = getScaledPreferredSizeForGraph ( ) ; mxRectangle min = graph . getMinimumGraphSize ( ) ; double scale = graph . getView ( ) . getScale ( ) ; boolean update = false ; if ( rect . x < 0 ) { translate . x = Math . max ( translate . x , Math . max ( 0 , - rect . x ) ) ; d . width = sp . width ; if ( min != null ) { d . width = ( int ) Math . max ( d . width , Math . round ( min . getWidth ( ) * scale ) ) ; } d . width += translate . x ; update = true ; } else if ( right > getWidth ( ) ) { d . width = Math . max ( right , getWidth ( ) ) ; update = true ; } if ( rect . y < 0 ) { translate . y = Math . max ( translate . y , Math . max ( 0 , - rect . y ) ) ; d . height = sp . height ; if ( min != null ) { d . height = ( int ) Math . max ( d . height , Math . round ( min . getHeight ( ) * scale ) ) ; } d . height += translate . y ; update = true ; } else if ( bottom > getHeight ( ) ) { d . height = Math . max ( bottom , getHeight ( ) ) ; update = true ; } if ( update ) { setPreferredSize ( d ) ; setMinimumSize ( d ) ; revalidate ( ) ; } }
Implements extension of the component in all directions.
Implements extension of the component in all directions .