Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -401,6 +401,23 @@ |
402 | 402 | /* size of the window */ |
403 | 403 | var pr_width = 0, pr_height = 0; |
404 | 404 | |
| 405 | +function set_container_css(show_scrollbars,default_cursor){ |
| 406 | + if(show_scrollbars) { |
| 407 | + self.container_css = self.container_css.replace("overflow:hidden","overflow:auto"); |
| 408 | + } else { |
| 409 | + self.container_css = self.container_css.replace("overflow:auto","overflow:hidden"); |
| 410 | + } |
| 411 | + if(default_cursor) { |
| 412 | + self.container_css = self.container_css.replace("cursor:crosshair","cursor:default"); |
| 413 | + } else { |
| 414 | + self.container_css = self.container_css.replace("cursor:default","cursor:crosshair"); |
| 415 | + } |
| 416 | + sl = pr_container.scrollLeft;//save scrollbar value for Opera, Chrome |
| 417 | + st = pr_container.scrollTop; |
| 418 | + pr_container.style.cssText = self.container_css; |
| 419 | + pr_container.scrollLeft = sl; |
| 420 | + pr_container.scrollTop = st; |
| 421 | +} |
405 | 422 | |
406 | 423 | function pr_drop(evt){ |
407 | 424 | evt = evt?evt:window.event?window.event:null; if(!evt){ return false;} |
— | — | @@ -410,29 +427,11 @@ |
411 | 428 | document.onmousemove = null; |
412 | 429 | document.onmousedown = null; |
413 | 430 | pr_container.onmousemove = pr_move; |
414 | | - |
415 | 431 | if( is_drag==false ) { |
416 | | - if( is_zoom ) { |
417 | | - is_zoom = false; |
418 | | - self.container_css = self.container_css.replace("overflow:hidden","overflow:auto"); |
419 | | - self.container_css = self.container_css.replace("cursor:crosshair","cursor:default"); |
420 | | - sl = pr_container.scrollLeft;//save scrollbar value for Opera, Chrome |
421 | | - st = pr_container.scrollTop; |
422 | | - pr_container.style.cssText = self.container_css; |
423 | | - pr_container.scrollLeft = sl; |
424 | | - pr_container.scrollTop = st; |
425 | | - } else { |
426 | | - is_zoom = true; |
427 | | - self.container_css = self.container_css.replace("overflow:auto","overflow:hidden"); |
428 | | - self.container_css = self.container_css.replace("cursor:default","cursor:crosshair"); |
429 | | - sl = pr_container.scrollLeft; |
430 | | - st = pr_container.scrollTop; |
431 | | - pr_container.style.cssText = self.container_css; |
432 | | - pr_container.scrollLeft = sl; |
433 | | - pr_container.scrollTop = st; |
434 | | - } |
| 432 | + is_zoom = !is_zoom; |
435 | 433 | } |
436 | 434 | is_drag = false; |
| 435 | + set_container_css(!is_zoom,!is_zoom); |
437 | 436 | return false; |
438 | 437 | } |
439 | 438 | |
— | — | @@ -467,7 +466,7 @@ |
468 | 467 | init_x = pr_container.scrollLeft + lastxx; |
469 | 468 | init_y = pr_container.scrollTop + lastyy; |
470 | 469 | is_drag = false; |
471 | | - |
| 470 | + set_container_css(!is_zoom,!is_zoom); |
472 | 471 | return false; |
473 | 472 | |
474 | 473 | } |
— | — | @@ -488,6 +487,7 @@ |
489 | 488 | if (evt.preventDefault) evt.preventDefault(); |
490 | 489 | evt.returnValue = false; |
491 | 490 | is_drag = true; |
| 491 | + set_container_css(true,!is_zoom); |
492 | 492 | return false; |
493 | 493 | } |
494 | 494 | |