Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | $wgSpecialPageGroups['IndexPages'] = 'pages'; |
35 | 35 | |
36 | 36 | # Bump the version number every time you change proofread.js |
37 | | -$wgProofreadPageVersion = 24; |
| 37 | +$wgProofreadPageVersion = 25; |
38 | 38 | |
39 | 39 | # Max width of zoomable image |
40 | 40 | $wgProofreadPageMaxWidth = 2048; |
Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -402,8 +402,8 @@ |
403 | 403 | var prev_margin_y = 0; |
404 | 404 | var init_x = 0; |
405 | 405 | var init_y = 0; |
| 406 | +var is_drag = false; |
406 | 407 | |
407 | | - |
408 | 408 | function pr_drop(evt){ |
409 | 409 | prev_margin_x = margin_x; |
410 | 410 | prev_margin_y = margin_y; |
— | — | @@ -411,6 +411,24 @@ |
412 | 412 | document.onmousemove = null; |
413 | 413 | document.onmousedown = null; |
414 | 414 | zp_container.onmousemove = pr_move; |
| 415 | + |
| 416 | + var image_container = document.getElementById("pr_container"); |
| 417 | + if( is_drag==false ) { |
| 418 | + if( self.container_css.search("overflow:hidden") > -1 ) { |
| 419 | + self.container_css = self.container_css.replace("overflow:hidden","overflow:auto"); |
| 420 | + self.container_css = self.container_css.replace("cursor:crosshair","cursor:default"); |
| 421 | + image_container.style.cssText = self.container_css; |
| 422 | + if (image_container.removeEventListener) |
| 423 | + image_container.removeEventListener('DOMMouseScroll', pr_zoom_wheel, false); |
| 424 | + } else { |
| 425 | + self.container_css = self.container_css.replace("overflow:auto","overflow:hidden"); |
| 426 | + self.container_css = self.container_css.replace("cursor:default","cursor:crosshair"); |
| 427 | + image_container.style.cssText = self.container_css; |
| 428 | + if (image_container.addEventListener) |
| 429 | + image_container.addEventListener('DOMMouseScroll', pr_zoom_wheel, false); |
| 430 | + } |
| 431 | + } |
| 432 | + is_drag = false; |
415 | 433 | return false; |
416 | 434 | } |
417 | 435 | |
— | — | @@ -431,7 +449,7 @@ |
432 | 450 | document.onmousemove = pr_drag; |
433 | 451 | document.onmouseup = pr_drop; |
434 | 452 | zp_container.onmousemove = pr_drag; |
435 | | - |
| 453 | + |
436 | 454 | if(evt.pageX) { |
437 | 455 | countoffset(); |
438 | 456 | lastxx=evt.pageX - ffox; |
— | — | @@ -445,6 +463,7 @@ |
446 | 464 | |
447 | 465 | init_x = lastxx; |
448 | 466 | init_y = lastyy; |
| 467 | + is_drag = false; |
449 | 468 | |
450 | 469 | return false; |
451 | 470 | |
— | — | @@ -467,6 +486,7 @@ |
468 | 487 | |
469 | 488 | if (evt.preventDefault) evt.preventDefault(); |
470 | 489 | evt.returnValue = false; |
| 490 | + is_drag = true; |
471 | 491 | return false; |
472 | 492 | } |
473 | 493 | |
— | — | @@ -579,8 +599,10 @@ |
580 | 600 | } |
581 | 601 | else { |
582 | 602 | self.table.appendChild(self.text_container); |
583 | | - var tb = document.getElementById("toolbar"); |
584 | | - tb.parentNode.insertBefore(image_container,tb); |
| 603 | + form = document.getElementById("editform"); |
| 604 | + tb = document.getElementById("toolbar"); |
| 605 | + if(tb) tb.parentNode.insertBefore(image_container,tb); |
| 606 | + else form.parentNode.insertBefore(image_container,form); |
585 | 607 | } |
586 | 608 | |
587 | 609 | self.pr_horiz = horizontal_layout; |
— | — | @@ -618,13 +640,14 @@ |
619 | 641 | self.DisplayHeight = Math.ceil(height*0.85); |
620 | 642 | self.DisplayWidth = parseInt(width/2-70); |
621 | 643 | img_w = self.DisplayWidth; |
622 | | - self.container_css = "background:#000000; overflow:hidden; width:"+self.DisplayWidth+"px; height:"+self.DisplayHeight+"px;"; |
| 644 | + css_wh = "width:"+self.DisplayWidth+"px; height:"+self.DisplayHeight+"px;"; |
623 | 645 | } |
624 | 646 | else{ |
625 | 647 | self.DisplayHeight = Math.ceil(height*0.4); |
626 | 648 | img_w = 0; //prevent the container from being resized when the image is downloaded. |
627 | | - self.container_css = "background:#000000; overflow:auto; width:100%; height:"+self.DisplayHeight+"px;"; |
| 649 | + css_wh = "width:100%; height:"+self.DisplayHeight+"px;"; |
628 | 650 | } |
| 651 | + self.container_css = "cursor:default; background:#000000; overflow:auto; " + css_wh; |
629 | 652 | image_container.innerHTML = |
630 | 653 | "<img id=\"ProofReadImage\" src=\"" |
631 | 654 | + escapeQuotesHTML(proofreadPageViewURL) |
— | — | @@ -632,14 +655,7 @@ |
633 | 656 | |
634 | 657 | image_container.style.cssText = self.container_css; |
635 | 658 | pr_zoom(0); |
636 | | - } |
637 | 659 | |
638 | | - //setup the mouse wheel listener |
639 | | - if(proofreadPageIsEdit) { |
640 | | - if(!horizontal_layout){ |
641 | | - if (image_container.addEventListener) image_container.addEventListener('DOMMouseScroll', pr_zoom_wheel, false); |
642 | | - image_container.onmousewheel = pr_zoom_wheel; |
643 | | - } |
644 | 660 | image_container.onmousedown = pr_grab; |
645 | 661 | image_container.onmousemove = pr_move; |
646 | 662 | |