Mercurial > hg > digilib
comparison client/digitallibrary/greyskin/dllib.js @ 516:e04c954edea0
Reset-Button und Funktion
| author | hertzhaft |
|---|---|
| date | Tue, 08 Sep 2009 13:19:43 +0200 |
| parents | 9fa19391ef38 |
| children | 20f10e77155c |
comparison
equal
deleted
inserted
replaced
| 514:3f247d227c3c | 516:e04c954edea0 |
|---|---|
| 196 // mouse drag area that counts as one click | 196 // mouse drag area that counts as one click |
| 197 this.MIN_AREA_SIZE = 3 * 3 + 1; | 197 this.MIN_AREA_SIZE = 3 * 3 + 1; |
| 198 // standard zoom factor | 198 // standard zoom factor |
| 199 this.ZOOMFACTOR = Math.sqrt(2); | 199 this.ZOOMFACTOR = Math.sqrt(2); |
| 200 // bird's eye view dimensions | 200 // bird's eye view dimensions |
| 201 this.BIRD_MAXX = 100; | 201 this.BIRD_MAXX = 200; |
| 202 this.BIRD_MAXY = 100; | 202 this.BIRD_MAXY = 200; |
| 203 // witdh of arrow bars | 203 // witdh of arrow bars |
| 204 this.ARROW_WIDTH = 32; | 204 this.ARROW_WIDTH = 32; |
| 205 // width of calibration bar | 205 // width of calibration bar |
| 206 this.CALIBRATION_WIDTH = 64; | 206 this.CALIBRATION_WIDTH = 64; |
| 207 /* variables */ | 207 /* variables */ |
| 349 digilib.renderMarks(); | 349 digilib.renderMarks(); |
| 350 digilib.showBirdDiv(isBirdDivVisible); | 350 digilib.showBirdDiv(isBirdDivVisible); |
| 351 digilib.showArrows(); // show arrow overlays for zoom navigation | 351 digilib.showArrows(); // show arrow overlays for zoom navigation |
| 352 //digilib.moveCenter(true); // click to move point to center | 352 //digilib.moveCenter(true); // click to move point to center |
| 353 // new Slider("sizes", 1, 5, 2); | 353 // new Slider("sizes", 1, 5, 2); |
| 354 | |
| 355 //Drag Image (6.9.2009, not yet working) | |
| 356 //registerEvent("mousedown", digilib.scalerDiv, dragImage); | |
| 357 | |
| 354 focus(); | 358 focus(); |
| 355 } | 359 } |
| 356 } | 360 } |
| 357 | 361 |
| 358 Digilib.prototype.renderMarks = function() { | 362 Digilib.prototype.renderMarks = function() { |
| 419 | 423 |
| 420 Digilib.prototype.removeMark = function() { | 424 Digilib.prototype.removeMark = function() { |
| 421 // remove the last mark | 425 // remove the last mark |
| 422 this.marks.pop(); | 426 this.marks.pop(); |
| 423 this.display(); | 427 this.display(); |
| 428 } | |
| 429 | |
| 430 Digilib.prototype.resetImage = function() { | |
| 431 // reset the image to its original state | |
| 432 this.display(this.params.PARAM_FILE); // keep only fn/pn | |
| 433 } | |
| 434 | |
| 435 Digilib.prototype.dragImage = function(evt) { | |
| 436 // drag the image and load a new detail on mouse up | |
| 437 // makes sense only when zoomed | |
| 438 if (this.isFullArea()) | |
| 439 return; | |
| 440 var startPos = evtPosition(evt); | |
| 441 var picRect = getElementRect(this.scalerImg); | |
| 442 var newRect; // position after drag | |
| 443 // start event capturing | |
| 444 registerEvent("mousemove", document, moveDragEvent); | |
| 445 registerEvent("mouseup", document, moveEndEvent); | |
| 446 window.focus(); | |
| 447 | |
| 448 // our own reference to this for the local function | |
| 449 var digilib = this; | |
| 450 | |
| 451 function moveDragEvent(evt) { | |
| 452 // mousemove handler: drag | |
| 453 var pos = evtPosition(evt); | |
| 454 var dx = pos.x - startPos.x; | |
| 455 var dy = pos.y - startPos.y; | |
| 456 // move scalerImg div | |
| 457 newRect = new Rectangle( | |
| 458 picRect.x + dx, | |
| 459 picRect.y + dy, | |
| 460 picRect.width, | |
| 461 picRect.height); | |
| 462 // move scalerImg to new position | |
| 463 moveElement(this.scalerImg, newRect); | |
| 464 return stopEvent(evt); | |
| 465 } | |
| 466 | |
| 467 function moveEndEvent(evt) { | |
| 468 // mouseup handler: reload page | |
| 469 unregisterEvent("mousemove", document, moveDragEvent); | |
| 470 unregisterEvent("mouseup", document, moveEndEvent); | |
| 471 if (newRect == null) { // no movement happened | |
| 472 return stopEvent(evt); | |
| 473 } | |
| 474 var newX = cropFloat(newRect.x - picRect.x); | |
| 475 var newY = cropFloat(newRect.y - picRect.y); | |
| 476 // if (newX < 0) newX = 0; | |
| 477 // if (newY < 0) newY = 0; | |
| 478 digilib.params.set("wx", newX); | |
| 479 digilib.params.set("wy", newY); | |
| 480 // zoomed is always fit | |
| 481 // digilib.params.set("ws", 1); | |
| 482 digilib.display(); | |
| 483 return stopEvent(evt); | |
| 484 } | |
| 424 } | 485 } |
| 425 | 486 |
| 426 Digilib.prototype.zoomArea = function() { | 487 Digilib.prototype.zoomArea = function() { |
| 427 var pt1, pt2; | 488 var pt1, pt2; |
| 428 var zoomdiv = getElement("zoom"); | 489 var zoomdiv = getElement("zoom"); |
| 943 /* old digilib function compatibility */ | 1004 /* old digilib function compatibility */ |
| 944 function setDLParam(e, s, relative) {dl.setDLParam(e, s, relative)}; | 1005 function setDLParam(e, s, relative) {dl.setDLParam(e, s, relative)}; |
| 945 function display(detail, moDetail) {dl.display(detail, moDetail)}; | 1006 function display(detail, moDetail) {dl.display(detail, moDetail)}; |
| 946 function setMark(reload) {dl.setMark(reload)}; | 1007 function setMark(reload) {dl.setMark(reload)}; |
| 947 function removeMark(reload) {dl.removeMark(reload)}; | 1008 function removeMark(reload) {dl.removeMark(reload)}; |
| 1009 function resetImage() {dl.resetImage()}; | |
| 1010 function dragImage(evt) {dl.dragImage(evt)}; | |
| 948 function zoomArea() {dl.zoomArea()}; | 1011 function zoomArea() {dl.zoomArea()}; |
| 949 function zoomBy(factor) {dl.zoomBy(factor)}; | 1012 function zoomBy(factor) {dl.zoomBy(factor)}; |
| 950 function zoomFullpage(a) {dl.zoomFullpage(a)}; | 1013 function zoomFullpage(a) {dl.zoomFullpage(a)}; |
| 951 function moveCenter(on) {dl.moveCenter(on)}; | 1014 function moveCenter(on) {dl.moveCenter(on)}; |
| 952 function isFullArea(area) {dl.isFullArea(area)}; | 1015 function isFullArea(area) {dl.isFullArea(area)}; |
