Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -50,16 +50,22 @@ |
51 | 51 | |
52 | 52 | if(self.proofreadPageExternalURL) { |
53 | 53 | thumb_url = proofreadPageViewURL; |
| 54 | + self.DisplayWidth = requested_width; |
| 55 | + self.DisplayHeight = ""; |
54 | 56 | } |
55 | 57 | else { |
56 | 58 | //enforce quantization: width must be multiple of 100px |
57 | 59 | var width = (100*requested_width)/100; |
58 | 60 | //compare to the width of the image |
59 | 61 | if(width < proofreadPageWidth) { |
60 | | - thumb_url = proofreadPageThumbURL.replace('##WIDTH##',""+width); |
| 62 | + thumb_url = proofreadPageThumbURL.replace('##WIDTH##',""+width); |
| 63 | + self.DisplayWidth = requested_width; |
| 64 | + self.DisplayHeight = requested_width*proofreadPageHeight/proofreadPageWidth; |
61 | 65 | } |
62 | 66 | else { |
63 | | - thumb_url = proofreadPageViewURL; |
| 67 | + thumb_url = proofreadPageViewURL; |
| 68 | + self.DisplayWidth = proofreadPageWidth; |
| 69 | + self.DisplayHeight = proofreadPageHeight; |
64 | 70 | } |
65 | 71 | } |
66 | 72 | return thumb_url; |
— | — | @@ -428,7 +434,7 @@ |
429 | 435 | if(!zp_img) return; |
430 | 436 | |
431 | 437 | if (delta == 0) { |
432 | | - zp_img.width = document.getElementById("ImageContainer").offsetWidth-20; |
| 438 | + zp_img.width = document.getElementById("ImageContainer").offsetWidth; //-20; |
433 | 439 | zp_img.style.margin = '0px 0px 0px 0px'; |
434 | 440 | prev_margin_x = margin_x = 0; |
435 | 441 | prev_margin_y = margin_y = 0; |
— | — | @@ -537,8 +543,9 @@ |
538 | 544 | desired_width = parseInt(window.innerWidth/2-70); |
539 | 545 | } |
540 | 546 | } |
| 547 | + //this sets DisplayWidth and DisplayHeight |
541 | 548 | var thumb_url = pr_image_url(desired_width); |
542 | | - |
| 549 | + |
543 | 550 | //self.DisplayHeight is known if the image is not external |
544 | 551 | if(self.DisplayHeight) |
545 | 552 | self.TextBoxHeight = self.DisplayHeight; |
— | — | @@ -550,14 +557,14 @@ |
551 | 558 | var image = document.createElement("img"); |
552 | 559 | image.setAttribute("src", thumb_url); |
553 | 560 | image.setAttribute("id", "ProofReadImage"); |
554 | | - image.setAttribute("width", desired_width); |
| 561 | + image.setAttribute("width", self.DisplayWidth); |
555 | 562 | image.style.cssText = "padding:0;margin:0;border:0;"; |
556 | 563 | image_container.appendChild(image); |
557 | 564 | } |
558 | 565 | else{ |
559 | | - var s = "<div id=\"pr_container\" style=\"background:#000000; overflow: auto; width: "+desired_width+"px;\">"; |
| 566 | + var s = "<div id=\"pr_container\" style=\"background:#000000; overflow: auto; width: "+self.DisplayWidth+"px; height:"+self.TextBoxHeight+"px;\">"; |
560 | 567 | s = s + "<img id=\"ProofReadImage\" src=\""+ proofreadPageViewURL +"\" alt=\""+ proofreadPageViewURL +"\""; |
561 | | - s = s + " width=\"" + desired_width +"\"></div>"; |
| 568 | + s = s + " width=\"" + self.DisplayWidth +"\"></div>"; |
562 | 569 | image_container.innerHTML = s; |
563 | 570 | document.getElementById("wpTextbox1").style.cssText = "height:"+(self.TextBoxHeight-7)+"px"; |
564 | 571 | pr_zoom(0); |