public static Double getScaleRatioToFitInDimension(Dimension currentSize,
			Dimension targetSize) {

		if (currentSize.width < targetSize.width && currentSize.height < targetSize.height) {
			// go to max zoom
			return 1.0;
		}

		if (currentSize.width > targetSize.width || currentSize.height > targetSize.height) {
			return zoomOutRatio(currentSize, targetSize);
		}

		return null;
	}
Get the upper-left point of vertex in the view space (Java component space)
 
@param viewer the viewer containing the UI 
@param vertex the vertex
@return the upper-left point of the vertex
Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/GraphViewerUtils.java