⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zoom.htm

📁 万能配电器原理说明: 图1: 服务器主要具有收集万能配电器的参数值,和修改万能配电器的内部设置的功能.服务器是通过配电集线器分出多组万能配电器来控制和显示万能配电器的参数.而服务器于配电集线器的方
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<style type="text/css">
	 v\:* { behavior: url(#default#VML); }
</style>

<script type="text/jscript" language="jscript">

var BUFFER = 1;

function zoomObject()
{
	this.PZImgRatio			= null;
	
	this.zoomWinHeight		= null;
	this.zoomWinWidth		= null;
	this.zoomWinTop			= null;
	this.zoomWinLeft		= null;
	
	this.scaleFactor		= null;
	
	this.updateContent		= zObj_updateContent;
	this.doOnBodyResize		= zObj_doOnBodyResize;
	this.clipZoomRect		= zObj_clipZoomRect;
}

var g_thumbHeight = window.clientHeight;
var g_thumbWidth = window.clientWidth;
zoomObj = new zoomObject();


function showObject( divObject, divID ) 
{
	if( divObject == null )
		divObject = getObj( divID );
	
	if( divObject != null ) 
	{
		divObject.style.visibility = "visible"
	}
	return divObject;
}

function hideObject( divObject, divID ) 
{
	if( divObject == null )
		divObject = getObj( divID );
	
	if( divObject != null ) 
	{
		divObject.style.visibility = "hidden";
	}
	return divObject;
}

function zObj_updateContent( win_width, win_height, VMLDiv_left, VMLDiv_top, VMLDiv_width, VMLDiv_height )
{
	this.mainWinWidth		= win_width;
	this.mainWinHeight		= win_height;

	this.mainImgRatio = VMLDiv_height / VMLDiv_width;
	this.doOnBodyResize();
}

function zObj_doOnBodyResize()
{
	return;
}

function zObj_clipZoomRect( objectToClip )
{
	if( objectToClip == null )
	{
		objectToClip = zoomRectObj;
	}
	
	var clipTop		= ( objectToClip.style.posTop < (g_thumbTop) )	? (g_thumbTop - objectToClip.style.posTop)	: 0;
	var clipLeft	= ( objectToClip.style.posLeft < (g_thumbLeft) )	? (g_thumbLeft - objectToClip.style.posLeft)	: 0;
	var clipBottom	= ( (objectToClip.style.posHeight - clipTop) > (g_thumbTop + g_thumbHeight + 2 * BUFFER) ) ? (g_thumbHeight + clipTop + BUFFER) : objectToClip.style.posHeight;
	var clipRight	= 0;
	if( (this.zoomWinWidth - clipLeft) > (g_thumbLeft + g_thumbWidth) )
	{
		if( clipLeft == 0 )
		{
			clipRight = g_thumbWidth - objectToClip.style.posLeft + 2 * BUFFER;
		}
		else
		{
			clipRight = (g_thumbWidth + clipLeft + BUFFER);
		}
	}
	else
	{
		clipRight = objectToClip.style.posWidth;
	}
	clipTo( objectToClip, clipTop, clipRight, clipBottom, clipLeft);
}

function findContent()
{
	zoomRectDiv.style.display = "none";
	newZoomWindowDiv.style.display = "none";

	if (parent.parent.frmDrawing && parent.parent.viewMgr)
	{
		var viewMgr = parent.parent.viewMgr;

		var getPNZ = parent.parent.viewMgr.getPNZ;
		if (getPNZ)
		{
			var tmp = parent.parent.frmDrawing;

			divThumb = document.all("divThumbnail");

			if (divThumb.innerHTML.length == 0)
			{
				divThumb.innerHTML = getPNZ();
			}
			else
			{
				var pnzInfo = getPNZ();
				var idIndex = pnzInfo.indexOf("ConvertedImage");
				if (idIndex >= 0)
				{
					var test = pnzInfo;
					pnzInfo = test.substring (0, idIndex);
					pnzInfo += "Temp";
					pnzInfo += test.substring (idIndex, test.length);

					divTempThumbnail.innerHTML = pnzInfo;

					var vmlGroup = divThumbnail.childNodes(0);
					var vmlTempGroup = divTempThumbnail.childNodes(0);
					CopyVMLAttrs(vmlGroup, vmlTempGroup);
					
					var vmlShape = vmlGroup.childNodes(1);
					var vmlTempShape = vmlTempGroup.childNodes(1);
					CopyVMLAttrs(vmlShape, vmlTempShape);

					CopyVMLAttrs(vmlGroup.childNodes(0), vmlTempGroup.childNodes(0));
					
					var vmlImageData = vmlShape.childNodes(0);
					var vmlTempImageData = vmlTempShape.childNodes(0);
					CopyVMLImageData(vmlImageData, vmlTempImageData);
				}
			}

			zoomRectObj = document.all("zoomRectDiv");
			showObject( zoomRectObj );

			PNZimg = document.all("ConvertedImage");
			if (PNZimg)
			{
				PNZimg.style.left = 0;
				PNZimg.style.top = 0;

				if (PNZimg.style.pixelWidth > PNZimg.style.pixelHeight)
				{
					var oldWidth = PNZimg.style.pixelWidth;
					PNZimg.style.width = document.body.clientWidth;
					PNZimg.style.height = (document.body.clientWidth / oldWidth) * PNZimg.style.pixelHeight;

					divThumb.style.top = (document.body.clientHeight - parseInt(PNZimg.style.height)) / 2;
					divThumb.style.left = 0;
				}
				else
				{
					var oldHeight = PNZimg.style.pixelHeight;
					PNZimg.style.height = document.body.clientHeight;
					PNZimg.style.width = (document.body.clientHeight / oldHeight) * PNZimg.style.pixelWidth;

					divThumb.style.left = (document.body.clientWidth - parseInt(PNZimg.style.width)) / 2;
					divThumb.style.top = 0;
				}

				PNZimg.style.visibility = "visible";

				var strOutput = divThumb.innerHTML;
				if (strOutput.length > 0)
				{
					var tmp2 = document.all['ConvertedImage'];
					zoomObj.updateContent( tmp.document.body.clientWidth, tmp.document.body.clientHeight, parseInt(tmp2.style.left), parseInt(tmp2.style.top), parseInt(tmp2.clientWidth), parseInt(tmp2.clientHeight) );

					viewMgr.viewChanged = PageViewChanged;
				}
			}
		}
	}
}

function CopyVMLAttrs(vmlObjDst, vmlObjSrc)
{
	if (vmlObjDst != null && vmlObjSrc != null)
	{
		vmlObjDst.style.cssText = vmlObjSrc.style.cssText;
	}
}

function CopyVMLImageData(vmlImageDataDst, vmlImageDataSrc)
{
	if (vmlImageDataDst != null && vmlImageDataSrc != null)
	{
		vmlImageDataDst.src = vmlImageDataSrc.src;
	}
}

function setZoomRectCursor()
{
	var x = getMouseXcoord() - zoomObj.zoomWinLeft;
	var y = getMouseYcoord() - zoomObj.zoomWinTop;

	var rbw = 5;

	var newCursor	= "";
	if( y > (zoomObj.zoomWinHeight - rbw) )
		newCursor = "s"
	else if( y < rbw )
		newCursor = "n";
		
	if( x < rbw )
		newCursor += "w";
	else if( x > (zoomObj.zoomWinWidth - rbw) )
		newCursor += "e";

	if( newCursor != "" )
		zoomRectObj.style.cursor = newCursor + "-resize";
	else
		zoomRectObj.style.cursor = "move";
}

function startZoomRectDrag()
{
	var currentCursor = zoomRectObj.style.cursor;

	if( currentCursor.indexOf( '-' ) != -1 )
	{
		g_resizeDirection = currentCursor.split( '-' )[0];
		startDrag( 'zoomRectDiv', doResizeZoomRectDrag, stopResizeZoomRectDrag );
	}
	else
	{
		startDrag( 'zoomRectDiv', doZoomRectDrag, stopZoomRectDrag );
	}
}

function doZoomRectDrag(dragObj, x, y)
{
	var PNZimg = document.all("ConvertedImage");

	var rectLeft = parseInt(dragObj.divObject.style.left);
	var rectTop = parseInt(dragObj.divObject.style.top);
	var rectWidth = parseInt(dragObj.divObject.style.width);
	var rectHeight = parseInt(dragObj.divObject.style.height);

	var xOffset = 0;
	var yOffset = 0;

	var xPercent = 0;
	var yPercent = 0;

	var pnzImgLeft = parseInt(divThumbnail.style.left);
	var pnzImgTop = parseInt(divThumbnail.style.top);
	var pnzImgWidth = parseInt(PNZimg.style.pixelWidth);
	var pnzImgHeight = parseInt(PNZimg.style.pixelHeight);
		
	xOffset = x + dragObj.xOffset - pnzImgLeft;
	xPercent = xOffset / pnzImgWidth;

	yOffset = y + dragObj.yOffset - pnzImgTop;
	yPercent = yOffset / pnzImgHeight;

	if (xOffset < 0)
	{
		xPercent = 0;
		xOffset = pnzImgLeft - BUFFER;
	}
	else if (xOffset + rectWidth > pnzImgWidth)
	{
		xPercent = 1;
		xOffset = pnzImgLeft + pnzImgWidth - rectWidth + BUFFER;
	}
	else
	{
		xOffset = x + dragObj.xOffset;
	}

	if (yOffset < 0)
	{
		yPercent = 0;
		yOffset = pnzImgTop - BUFFER;
	}
	else if (yOffset + rectHeight > pnzImgHeight)
	{
		yPercent = 1;
		yOffset = pnzImgTop + pnzImgHeight - rectHeight + BUFFER;
	}
	else
	{
		yOffset = y + dragObj.yOffset;
	}

	if (parent.parent.viewMgr.setView)
	{
		var viewMgr = parent.parent.viewMgr;
		viewMgr.PostSetViewProcessing = PostSetViewProcessing;
		viewMgr.ChangingView = true;
		viewMgr.setView (xPercent, yPercent);
	}

	setZWinSize (null, null, xOffset, yOffset);
}

function stopZoomRectDrag(dragObj, x, y)
{
	var el = window.event.srcElement;
	g_newLeft = parseInt(el.style.left);
	g_newTop = parseInt(el.style.top);
}

function setZWinSize( newWidth, newHeight, newLeft, newTop )
{
	if( newWidth != null && newWidth >= 0 ) 
	{
		zoomObj.zoomWinWidth = newWidth;
		zoomRectObj.style.width = newWidth;
	}

	if( newHeight != null && newHeight >= 0 ) 
	{
		zoomObj.zoomWinHeight = newHeight;
		zoomRectObj.style.height = newHeight;
	}

	if( newLeft != null && newLeft >= 0 )
	{
		zoomObj.zoomWinLeft = newLeft;
		zoomRectObj.style.left = newLeft;
	}

	if( newTop != null && newTop >= 0 )
	{
		zoomObj.zoomWinTop = newTop;
		zoomRectObj.style.top= newTop;
	}
}

function doResizeZoomRectDrag(dragObj, x, y)
{
	var newWidth	= null;
	var newHeight	= null;
	var newLeft		= null;
	var newTop		= null;
		
	var tmp = parent.parent.frmDrawing;
	if (tmp)
	{
		zoomObj.mainWinWidth		= tmp.document.body.clientWidth;
		zoomObj.mainWinHeight		= tmp.document.body.clientHeight;
	}

	var widthHeightRatio = zoomObj.mainWinWidth / zoomObj.mainWinHeight;
	
	var minimumSize = 10;
	if( g_resizeDirection == 'e' )
	{
		newWidth	= Math.max( minimumSize, x - zoomObj.zoomWinLeft);
		newHeight	= newWidth / widthHeightRatio;
		newTop		= zoomObj.zoomWinTop - (newWidth - zoomObj.zoomWinWidth)/4;
		setZWinSize( newWidth, newHeight, newLeft, newTop );
		return;
	}

	if( g_resizeDirection == 'w' )
	{
		newWidth	= zoomObj.zoomWinWidth + zoomObj.zoomWinLeft - x;
		if( newWidth > minimumSize )
		{
			newHeight	= newWidth / widthHeightRatio;
			newTop		= zoomObj.zoomWinTop - (newWidth - zoomObj.zoomWinWidth)/4;
			newLeft		= x;
			setZWinSize( newWidth, newHeight, newLeft, newTop );
		}
		return;
	}

	if( g_resizeDirection == 'se' )
	{
		newWidth	= Math.max( minimumSize, x - zoomObj.zoomWinLeft);
		newHeight	= newWidth / widthHeightRatio;
		setZWinSize( newWidth, newHeight, newLeft, newTop );
		return;
	}

	if( g_resizeDirection == 's' )
	{
		newHeight	= Math.max( minimumSize, y - zoomObj.zoomWinTop);
		newWidth	= newHeight * widthHeightRatio;
		newLeft		= zoomObj.zoomWinLeft - (newHeight - zoomObj.zoomWinHeight)/2;
		setZWinSize( newWidth, newHeight, newLeft, newTop );
		return;
	}

	if( g_resizeDirection == 'sw' )
	{
		newHeight	= Math.max( minimumSize, y - zoomObj.zoomWinTop);
		newWidth	= newHeight * widthHeightRatio;
		newLeft		= zoomObj.zoomWinLeft - ((newHeight - zoomObj.zoomWinHeight) * zoomObj.zoomWinWidth / zoomObj.zoomWinHeight);
		setZWinSize( newWidth, newHeight, newLeft, newTop );
		return;
	}
	
	if( g_resizeDirection == 'n' )
	{
		newHeight	= zoomObj.zoomWinTop - y + zoomObj.zoomWinHeight;
		if( newHeight > minimumSize )
		{
			newWidth	= newHeight * widthHeightRatio;
			newTop		= y;
			newLeft		= zoomObj.zoomWinLeft - (newHeight - zoomObj.zoomWinHeight)/2;
			setZWinSize( newWidth, newHeight, newLeft, newTop );
		}
		return;
	}
	
	if( g_resizeDirection == 'ne' )
	{
		newHeight	= zoomObj.zoomWinTop - y + zoomObj.zoomWinHeight;
		if( newHeight > minimumSize )
		{
			newWidth	= newHeight * widthHeightRatio;
			newTop		= y;
			setZWinSize( newWidth, newHeight, newLeft, newTop );
		}
		return;
	}
	
	if( g_resizeDirection == 'nw' )
	{
		newHeight	= zoomObj.zoomWinTop - y + zoomObj.zoomWinHeight;
		if( newHeight > minimumSize )
		{
			newWidth	= newHeight * widthHeightRatio;
			newTop		= y;
			newLeft		= zoomObj.zoomWinLeft - ((newHeight - zoomObj.zoomWinHeight) * zoomObj.zoomWinWidth / zoomObj.zoomWinHeight);
			setZWinSize( newWidth, newHeight, newLeft, newTop );
		}
		return;
	}
}

function stopResizeZoomRectDrag(dragObj, x, y)
{
	PNZimg = document.all("ConvertedImage");

	var xWidthPercent = parseInt(zoomRectDiv.style.width) / PNZimg.style.pixelWidth;
	var yHeightPercent = parseInt(zoomRectDiv.style.height) / PNZimg.style.pixelHeight;

	var newZoomLevel = GetZoomLevel (xWidthPercent, yHeightPercent);

	if (parent.parent.viewMgr.Zoom)
	{
		var viewMgr = parent.parent.viewMgr;
		viewMgr.PostZoomProcessing = PostZoomProcessing;
		viewMgr.ChangingView = true;
		viewMgr.Zoom (newZoomLevel);
	}

	g_width = parseInt(zoomRectDiv.style.pixelWidth);
	g_height = parseInt(zoomRectDiv.style.pixelHeight);
	g_newLeft = parseInt(zoomRectDiv.style.left);
	g_newTop = parseInt(zoomRectDiv.style.top);
}

function GetZoomLevel (xWidthPercent, yHeightPercent)
{
	var newZoomLevel;
	if (xWidthPercent < yHeightPercent)
	{
		newZoomLevel = 100 / xWidthPercent;
	}
	else
	{
		newZoomLevel = 100 / yHeightPercent;
	}

	return newZoomLevel;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -