T_Dzoom.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. var maxSizeX = 100; // �ִ� ũ��
  2. var minSizeX = 10; // �ּ� ũ��
  3. var curSizeX = 100; // ���� ũ��
  4. var maxSizeY = 80; // �ִ� ũ��
  5. var minSizeY = 8; // �ּ� ũ��
  6. var curSizeY = 80; // ���� ũ��
  7. var unitSizeX = 5; // �̵� ����
  8. var unitSizeY = 4; // �̵� ����
  9. var curX = 0; // ���� ��ġ X
  10. var curY = 0; // ���� ��ġ Y
  11. var prevzoomX = 0;
  12. var prevzoomY = 0;
  13. var prevzoomSizeX = 100; // ���� ũ��
  14. var onLayer = false;
  15. function ImageChange()
  16. {
  17. eval("document.getElementById('remote').style.background = 'url(/resources/img/"+curSizeX+"_"+curSizeY+".jpg)';");
  18. document.getElementById('remote').style.backgroundRepeat = "no-repeat";
  19. }
  20. function movepic(img_name, img_src)
  21. {
  22. document[img_name].src = img_src;
  23. }
  24. function MoveUp()
  25. {
  26. if( curY < unitSizeY ) // �� �̻� �ö� �� ����
  27. return;
  28. curY = curY - unitSizeY;
  29. document.getElementById('remote').style.position = "relative";
  30. document.getElementById('remote').style.top = curY+"px";;
  31. }
  32. function MoveDown()
  33. {
  34. if( curY + curSizeY == maxSizeY) // �� �̻� ������ �� ����
  35. return;
  36. curY = curY + unitSizeY;
  37. if(curY + curSizeY > maxSizeY){
  38. curY = maxSizeY - curSizeY;
  39. }
  40. document.getElementById('remote').style.position = "relative";
  41. document.getElementById('remote').style.top = curY+"px";;
  42. }
  43. function MoveLeft()
  44. {
  45. if( curX < unitSizeX ) // �� �̻� �������� �̵��� �� ����
  46. return;
  47. curX = curX - unitSizeX;
  48. document.getElementById('remote').style.position = "relative";
  49. document.getElementById('remote').style.left = curX+"px";;
  50. }
  51. function MoveRight()
  52. {
  53. if( curX + curSizeX == maxSizeX) // �� �̻� ���������� �̵��� �� ����
  54. return;
  55. curX = curX + unitSizeX;
  56. document.getElementById('remote').style.position = "relative";
  57. document.getElementById('remote').style.left = curX+"px";;
  58. }
  59. function Move( moveX, moveY )
  60. {
  61. curX = moveX;
  62. curY = moveY;
  63. if ( curX + curSizeX > maxSizeX )
  64. curX = maxSizeX - curSizeX;
  65. if ( curY + curSizeY > maxSizeY )
  66. curY = maxSizeY - curSizeY;
  67. document.getElementById('remote').style.position = "relative";
  68. document.getElementById('remote').style.top = curY+"px";;
  69. document.getElementById('remote').style.left = curX+"px";;
  70. }
  71. function ZoomIn()
  72. {
  73. if( curSizeX <= minSizeX ) // �� �̻� �۾��� �� ����
  74. return;
  75. curSizeX = curSizeX - ( unitSizeX * 2 );
  76. curSizeY = curSizeY - ( unitSizeY * 2 );
  77. document.getElementById('remote').style.width = curSizeX+"px";
  78. document.getElementById('remote').style.height = curSizeY+"px";
  79. MoveDown();
  80. MoveRight();
  81. SetDigitalZoom(0);
  82. ImageChange();
  83. }
  84. function ZoomOut()
  85. {
  86. if( curSizeX >= maxSizeX ) // ���̻� Ŀ�� �� ����
  87. return;
  88. curSizeX = curSizeX + ( unitSizeX * 2 );
  89. curSizeY = curSizeY + ( unitSizeY * 2 );
  90. document.getElementById('remote').style.width = curSizeX+"px";
  91. document.getElementById('remote').style.height = curSizeY+"px";
  92. MoveUp();
  93. MoveLeft();
  94. if( curY + curSizeY > maxSizeY )
  95. MoveUp();
  96. if( curX + curSizeX > maxSizeX )
  97. MoveLeft();
  98. SetDigitalZoom(0);
  99. ImageChange();
  100. }
  101. function ZoomHome()
  102. {
  103. curSizeX = maxSizeX;
  104. curSizeY = maxSizeY;
  105. curX = 0;
  106. curY = 0;
  107. document.getElementById('remote').style.width = curSizeX+"px";
  108. document.getElementById('remote').style.height = curSizeY+"px";
  109. document.getElementById('remote').style.position = "relative";
  110. document.getElementById('remote').style.top = curY+"px";;
  111. document.getElementById('remote').style.left = curX+"px";;
  112. SetDigitalZoom(0);
  113. ImageChange();
  114. }
  115. function ButtonUp()
  116. {
  117. MoveUp();
  118. SetDigitalZoom(0);
  119. }
  120. function ButtonDown()
  121. {
  122. MoveDown();
  123. SetDigitalZoom(0);
  124. }
  125. function ButtonLeft()
  126. {
  127. MoveLeft();
  128. SetDigitalZoom(0);
  129. }
  130. function ButtonRight()
  131. {
  132. MoveRight();
  133. SetDigitalZoom(0);
  134. }
  135. function ButtonLeftUp()
  136. {
  137. MoveLeft();
  138. MoveUp();
  139. SetDigitalZoom(0);
  140. }
  141. function ButtonRightUp()
  142. {
  143. MoveRight();
  144. MoveUp();
  145. SetDigitalZoom(0);
  146. }
  147. function ButtonLeftDown()
  148. {
  149. MoveLeft();
  150. MoveDown();
  151. SetDigitalZoom(0);
  152. }
  153. function ButtonRightDown()
  154. {
  155. MoveRight();
  156. MoveDown();
  157. SetDigitalZoom(0);
  158. }
  159. function RedrawDzoom()
  160. {
  161. SetDigitalZoom(1);
  162. }
  163. function SetDigitalZoom(force)
  164. {
  165. var ratio = 0;
  166. var relativeposX = 0;
  167. var relativeposY = 0;
  168. if((prevzoomX != curX) || (prevzoomY != curY) || (prevzoomSizeX != curSizeX) || (force == 1)){
  169. prevzoomX = curX;
  170. prevzoomY = curY;
  171. prevzoomSizeX = curSizeX;
  172. if(trnPlayer == PLAYER_ACTIVEX){
  173. // ���⼭ tvs control
  174. // infoStr = "curSize : " + curSizeX + " / curX : " + curX + " / curY : " + curY;
  175. // document.iForm.result.value = document.iForm.result.value + infoStr + "\n";
  176. relativeposX = Math.round((tvs_get_width()) * curX / 100);
  177. relativeposY = Math.round((tvs_get_height()) * curY / 80);
  178. // alert("relativeposX = " + relativeposX + "relativeposY = " + relativeposY + "curSizeX = " + curSizeX);
  179. if(curSizeX == 100){
  180. tvs_digitalzoom(100, relativeposX, relativeposY);
  181. }
  182. else if(curSizeX == 90){
  183. tvs_digitalzoom(111, relativeposX, relativeposY);
  184. }
  185. else if(curSizeX == 80){
  186. tvs_digitalzoom(125, relativeposX, relativeposY);
  187. }
  188. else if(curSizeX == 70){
  189. tvs_digitalzoom(143, relativeposX, relativeposY);
  190. }
  191. else if(curSizeX == 60){
  192. tvs_digitalzoom(167, relativeposX, relativeposY);
  193. }
  194. else if(curSizeX == 50){
  195. tvs_digitalzoom(200, relativeposX, relativeposY);
  196. }
  197. else if(curSizeX == 40){
  198. tvs_digitalzoom(250, relativeposX, relativeposY);
  199. }
  200. else if(curSizeX == 30){
  201. tvs_digitalzoom(333, relativeposX, relativeposY);
  202. }
  203. else if(curSizeX == 20){
  204. tvs_digitalzoom(500, relativeposX, relativeposY);
  205. }
  206. else if(curSizeX == 10){
  207. tvs_digitalzoom(1000, relativeposX, relativeposY);
  208. }
  209. }
  210. else if(trnPlayer == PLAYER_CHROMEPLUGIN){
  211. var size = VXGMP_GetsizePlayer('vxgplayer1');
  212. relativeposX = Math.round((size.width) * curX / 100);
  213. relativeposY = Math.round((size.height) * curY / 80);
  214. // alert("relativeposX = " + relativeposX + "relativeposY = " + relativeposY + "curSizeX = " + curSizeX);
  215. if(curSizeX == 100){
  216. VXGMP_CustomDigitalZoom('vxgplayer1', 100, relativeposX, relativeposY);
  217. }
  218. else if(curSizeX == 90){
  219. VXGMP_CustomDigitalZoom('vxgplayer1', 111, relativeposX, relativeposY);
  220. }
  221. else if(curSizeX == 80){
  222. VXGMP_CustomDigitalZoom('vxgplayer1', 125, relativeposX, relativeposY);
  223. }
  224. else if(curSizeX == 70){
  225. VXGMP_CustomDigitalZoom('vxgplayer1', 143, relativeposX, relativeposY);
  226. }
  227. else if(curSizeX == 60){
  228. VXGMP_CustomDigitalZoom('vxgplayer1', 167, relativeposX, relativeposY);
  229. }
  230. else if(curSizeX == 50){
  231. VXGMP_CustomDigitalZoom('vxgplayer1', 200, relativeposX, relativeposY);
  232. }
  233. else if(curSizeX == 40){
  234. VXGMP_CustomDigitalZoom('vxgplayer1', 250, relativeposX, relativeposY);
  235. }
  236. else if(curSizeX == 30){
  237. VXGMP_CustomDigitalZoom('vxgplayer1', 333, relativeposX, relativeposY);
  238. }
  239. else if(curSizeX == 20){
  240. VXGMP_CustomDigitalZoom('vxgplayer1', 500, relativeposX, relativeposY);
  241. }
  242. else if(curSizeX == 10){
  243. VXGMP_CustomDigitalZoom('vxgplayer1', 1000, relativeposX, relativeposY);
  244. }
  245. }
  246. else if(trnPlayer == PLAYER_WEBSOCKET){
  247. var size = VXGWSMP_GetsizePlayer('vxgwsplayer1');
  248. relativeposX = Math.round((size.width) * curX / 100);
  249. relativeposY = Math.round((size.height) * curY / 80);
  250. // alert("relativeposX = " + relativeposX + "relativeposY = " + relativeposY + "curSizeX = " + curSizeX);
  251. if(curSizeX == 100){
  252. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 100, relativeposX, relativeposY);
  253. }
  254. else if(curSizeX == 90){
  255. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 111, relativeposX, relativeposY);
  256. }
  257. else if(curSizeX == 80){
  258. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 125, relativeposX, relativeposY);
  259. }
  260. else if(curSizeX == 70){
  261. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 143, relativeposX, relativeposY);
  262. }
  263. else if(curSizeX == 60){
  264. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 167, relativeposX, relativeposY);
  265. }
  266. else if(curSizeX == 50){
  267. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 200, relativeposX, relativeposY);
  268. }
  269. else if(curSizeX == 40){
  270. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 250, relativeposX, relativeposY);
  271. }
  272. else if(curSizeX == 30){
  273. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 333, relativeposX, relativeposY);
  274. }
  275. else if(curSizeX == 20){
  276. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 500, relativeposX, relativeposY);
  277. }
  278. else if(curSizeX == 10){
  279. VXGWSMP_CustomDigitalZoom('vxgwsplayer1', 1000, relativeposX, relativeposY);
  280. }
  281. }
  282. }
  283. }
  284. function onLayerSet( val )
  285. {
  286. onLayer = val;
  287. }
  288. function clickLayer()
  289. {
  290. clickX = window.event.offsetX; // Ŭ���� ��ġ ( ���� ���̾� �»�� ���� ��� ��ǥ )
  291. clickY = window.event.offsetY; // Ŭ���� ��ġ ( ���� ���̾� �»�� ���� ��� ��ǥ )
  292. clickMove ( clickX + curX, clickY + curY );
  293. SetDigitalZoom(0);
  294. }
  295. function clickTable()
  296. {
  297. if( onLayer )
  298. return;
  299. clickX = window.event.offsetX; // Ŭ���� ��ġ ( 100x100 ���̺� �»�� ���� ��� ��ǥ )
  300. clickY = window.event.offsetY; // Ŭ���� ��ġ ( 100x100 ���̺� �»�� ���� ��� ��ǥ )
  301. clickMove ( clickX, clickY );
  302. SetDigitalZoom(0);
  303. }
  304. function clickMove( x, y )
  305. {
  306. clickX = x; // Ŭ���� ��ġ ( 100x100 ���̺� �»�� ���� ��� ��ǥ )
  307. clickY = y; // Ŭ���� ��ġ ( 100x100 ���̺� �»�� ���� ��� ��ǥ )
  308. clickX = clickX - ( clickX % unitSizeX );
  309. clickY = clickY - ( clickY % unitSizeY );
  310. clickX = clickX - ( curSizeX / 2 );
  311. clickY = clickY - ( curSizeY / 2 );
  312. if( clickX < 0 )
  313. clickX = 0;
  314. if( clickY < 0 )
  315. clickY = 0;
  316. Move( clickX, clickY );
  317. }