version 1.3, 2004/04/16 14:07:08
|
version 1.4, 2004/04/28 09:03:21
|
Line 32 var dlTrafo = new Transform();
|
Line 32 var dlTrafo = new Transform();
|
if (! Array.prototype.push) { |
if (! Array.prototype.push) { |
Array.prototype.push = function(val) { |
Array.prototype.push = function(val) { |
this[this.length] = val; |
this[this.length] = val; |
|
return this.length; |
|
} |
|
Array.prototype.pop = function() { |
|
var val = this[this.length-1]; |
|
this.length -= 1; |
|
return val; |
} |
} |
} |
} |
|
|
Line 42 function cropFloat(x) {
|
Line 48 function cropFloat(x) {
|
|
|
function newParameter(name, defaultValue, detail) { |
function newParameter(name, defaultValue, detail) { |
// create a new parameter with a name and a default value |
// create a new parameter with a name and a default value |
if ( !dlParams[name] ) { |
if (dlParams[name]) { |
|
alert("Fatal: An object with name '" + name + "' already exists - cannot recreate!"); |
|
return false; |
|
} else { |
dlParams[name] = new Object(); |
dlParams[name] = new Object(); |
dlParams[name].defaultValue = defaultValue; |
dlParams[name].defaultValue = defaultValue; |
dlParams[name].hasValue = false; |
dlParams[name].hasValue = false; |
dlParams[name].value = defaultValue; |
dlParams[name].value = defaultValue; |
dlParams[name].detail = detail; |
dlParams[name].detail = detail; |
return dlParams[name]; |
return dlParams[name]; |
} else { |
|
alert("Fatal: An object with name '" + name + "' already exists - cannot recreate!"); |
|
return false; |
|
} |
} |
} |
} |
|
|
Line 64 function getParameter(name) {
|
Line 70 function getParameter(name) {
|
return dlParams[name].defaultValue; |
return dlParams[name].defaultValue; |
} |
} |
} else { |
} else { |
return false; |
return undefined; |
} |
} |
} |
} |
|
|
Line 73 function setParameter(name, value) {
|
Line 79 function setParameter(name, value) {
|
if (dlParams[name]) { |
if (dlParams[name]) { |
dlParams[name].value = value; |
dlParams[name].value = value; |
dlParams[name].hasValue = true; |
dlParams[name].hasValue = true; |
|
return true; |
} |
} |
|
return false; |
} |
} |
|
|
function getAllParameters(detail) { |
function getAllParameters(detail) { |
Line 112 function setParamFromRect(rect) {
|
Line 120 function setParamFromRect(rect) {
|
setParameter("wy", cropFloat(rect.y)); |
setParameter("wy", cropFloat(rect.y)); |
setParameter("ww", cropFloat(rect.width)); |
setParameter("ww", cropFloat(rect.width)); |
setParameter("wh", cropFloat(rect.height)); |
setParameter("wh", cropFloat(rect.height)); |
|
return true; |
} |
} |
|
|
function parseTrafo() { |
function parseTrafo() { |
// returns Transform from current dlArea and picsize |
// returns Transform from current dlArea and picsize |
var picsize = getElementSize("scaler"); |
var picsize = getElementSize("pic"); |
var trafo = new Transform(); |
var trafo = new Transform(); |
// subtract area offset and size |
// subtract area offset and size |
trafo.concat(getTranslation(new Position(-dlArea.x, -dlArea.y))); |
trafo.concat(getTranslation(new Position(-dlArea.x, -dlArea.y))); |
trafo.concat(getScale(new Size(1/dlArea.width, 1/dlArea.height))); |
trafo.concat(getScale(new Size(1/dlArea.width, 1/dlArea.height))); |
// scale to screen size |
// scale to screen size |
trafo.concat(getScale(picsize)); |
trafo.concat(getScale(picsize)); |
|
trafo.concat(getTranslation(picsize)); |
// rotate |
// rotate |
//trafo.concat(getRotation(- getParameter("rot"), new Position(0.5*picsize.width, 0.5*picsize.height))); |
//trafo.concat(getRotation(- getParameter("rot"), new Position(0.5*picsize.width, 0.5*picsize.height))); |
// mirror |
// mirror |
Line 157 function getAllMarks() {
|
Line 167 function getAllMarks() {
|
return marks.join(";"); |
return marks.join(";"); |
} |
} |
|
|
function addMark(x, y) { |
function addMark(pos) { |
// add a mark |
// add a mark |
dlMarks.push(new Position(x, y)); |
dlMarks.push(pos); |
setParameter("mk", getAllMarks()); |
setParameter("mk", getAllMarks()); |
|
return true; |
} |
} |
|
|
function deleteMark() { |
function deleteMark() { |
// delete the last mark |
// delete the last mark |
dlMarks.pop(); |
dlMarks.pop(); |
setParameter("mk", getAllMarks()); |
setParameter("mk", getAllMarks()); |
|
return true; |
} |
} |
|
|
function hasFlag(mode) { |
function hasFlag(mode) { |
// returns if mode flag is set |
// returns if mode flag is set |
return (dlFlags[mode] && (dlFlags[mode] != null)); |
return (dlFlags[mode]); |
} |
} |
|
|
function addFlag(mode) { |
function addFlag(mode) { |
// add a mode flag |
// add a mode flag |
dlFlags[mode] = mode; |
dlFlags[mode] = mode; |
|
return true; |
} |
} |
|
|
function removeFlag(mode) { |
function removeFlag(mode) { |
// remove a mode flag |
// remove a mode flag |
if (dlFlags[mode]) { |
if (dlFlags[mode]) { |
dlFlags[mode] = null; |
delete dlFlags[mode]; |
} |
} |
|
return true; |
} |
} |
|
|
function toggleFlag(mode) { |
function toggleFlag(mode) { |
// change a mode flag |
// change a mode flag |
if (dlFlags[mode]) { |
if (dlFlags[mode]) { |
dlFlags[mode] = null; |
delete dlFlags[mode]; |
} else { |
} else { |
dlFlags[mode] = mode; |
dlFlags[mode] = mode; |
} |
} |
|
return true; |
} |
} |
|
|
function getAllFlags() { |
function getAllFlags() { |
Line 225 function parseFlags() {
|
Line 240 function parseFlags() {
|
function Size(w, h) { |
function Size(w, h) { |
this.width = parseFloat(w); |
this.width = parseFloat(w); |
this.height = parseFloat(h); |
this.height = parseFloat(h); |
|
return this; |
} |
} |
|
|
/* |
/* |
Line 233 function Size(w, h) {
|
Line 249 function Size(w, h) {
|
function Position(x, y) { |
function Position(x, y) { |
this.x = parseFloat(x); |
this.x = parseFloat(x); |
this.y = parseFloat(y); |
this.y = parseFloat(y); |
|
return this; |
|
} |
|
function evtPosition(evt) { |
|
// returns the on-screen Position of the Event |
|
var x; |
|
var y; |
|
if (document.all) { |
|
x = parseInt(document.body.scrollLeft+event.clientX); |
|
y = parseInt(document.body.scrollLeft+event.clientY); |
|
} else { |
|
x = parseInt(evt.pageX); |
|
y = parseInt(evt.pageY); |
|
} |
|
return new Position(x, y); |
} |
} |
|
|
/* |
/* |
Line 243 function Rectangle(x, y, w, h) {
|
Line 273 function Rectangle(x, y, w, h) {
|
this.y = parseFloat(y); |
this.y = parseFloat(y); |
this.width = parseFloat(w); |
this.width = parseFloat(w); |
this.height = parseFloat(h); |
this.height = parseFloat(h); |
|
return this; |
} |
} |
Rectangle.prototype.copy = function() { |
Rectangle.prototype.copy = function() { |
// returns a copy of this Rectangle |
// returns a copy of this Rectangle |
Line 298 function Transform() {
|
Line 329 function Transform() {
|
this.m20 = 0.0; |
this.m20 = 0.0; |
this.m21 = 0.0; |
this.m21 = 0.0; |
this.m22 = 1.0; |
this.m22 = 1.0; |
|
return this; |
} |
} |
Transform.prototype.concat = function(traf) { |
Transform.prototype.concat = function(traf) { |
for (var i = 0; i < 3; i++) { |
for (var i = 0; i < 3; i++) { |
Line 309 Transform.prototype.concat = function(tr
|
Line 341 Transform.prototype.concat = function(tr
|
this["m"+i+j] = c; |
this["m"+i+j] = c; |
} |
} |
} |
} |
|
return this; |
} |
} |
Transform.prototype.transform = function(pos) { |
Transform.prototype.transform = function(pos) { |
var x = this.m00 * pos.x + this.m01 * pos.y + this.m02; |
var x = this.m00 * pos.x + this.m01 * pos.y + this.m02; |
Line 349 function getScale(size) {
|
Line 382 function getScale(size) {
|
|
|
function getElement(tagid) { |
function getElement(tagid) { |
// returns the named element object |
// returns the named element object |
if (document.all) { |
if (document.getElementById) { |
return document.all[tagid]; |
|
} else if (document.getElementById) { |
|
return document.getElementById(tagid); |
return document.getElementById(tagid); |
|
} else if (document.all) { |
|
alert("document.all!"); |
|
return document.all[tagid]; |
} else { |
} else { |
|
alert("no document.all!"); |
return document[tagid]; |
return document[tagid]; |
} |
} |
} |
} |
Line 365 function getElementSize(tagid) {
|
Line 400 function getElementSize(tagid) {
|
var width = 0; |
var width = 0; |
var height = 0; |
var height = 0; |
var elem = getElement(tagid); |
var elem = getElement(tagid); |
if (elem.offsetWidth) { |
if (elem.left) { |
x = parseInt(elem.offsetLeft); |
alert("elem.left!"); |
y = parseInt(elem.offsetTop); |
x = elem.left; |
width = parseInt(elem.offsetWidth); |
y = elem.top; |
height = parseInt(elem.offsetHeight); |
width = elem.width; |
} else { |
height = elem.height; |
x = parseInt(elem.left); |
} else { |
y = parseInt(elem.top); |
if (elem.clientLeft) { |
width = parseInt(elem.clip.width); |
// spass mit IE |
height = parseInt(elem.clip.height); |
x = elem.clientLeft; |
|
y = elem.clientTop; |
|
} else { |
|
var e = elem; |
|
while (e) { |
|
x += e.offsetLeft; |
|
y += e.offsetTop; |
|
e = e.offsetParent; |
|
} |
|
} |
|
width = elem.offsetWidth; |
|
height = elem.offsetHeight; |
} |
} |
return new Rectangle(x, y, width, height); |
return new Rectangle(x, y, width, height); |
} |
} |
Line 383 function moveElement(tagid, pos) {
|
Line 429 function moveElement(tagid, pos) {
|
// moves the named element to the indicated position |
// moves the named element to the indicated position |
var elem = getElement(tagid); |
var elem = getElement(tagid); |
if (elem.style) { |
if (elem.style) { |
elem.style.left = pos.x; |
elem.style.left = pos.x + "px"; |
elem.style.top = pos.y; |
elem.style.top = pos.y + "px"; |
} else { |
} else { |
alert("moveelement: no style property!"); |
alert("moveelement: no style property!"); |
|
elem.left = pos.x; |
|
elem.top = pos.y; |
} |
} |
|
return true; |
} |
} |
|
|
function showElement(tagid, show) { |
function showElement(tagid, show) { |
Line 402 function showElement(tagid, show) {
|
Line 451 function showElement(tagid, show) {
|
} else { |
} else { |
alert("showelement: no style property!"); |
alert("showelement: no style property!"); |
} |
} |
|
return true; |
} |
} |
|
|
function registerMouseDown(tagid, handler) { |
function registerMouseDown(tagid, handler) { |
Line 414 function registerMouseDown(tagid, handle
|
Line 464 function registerMouseDown(tagid, handle
|
document[tagid].captureEvents(Event.MOUSEDOWN); |
document[tagid].captureEvents(Event.MOUSEDOWN); |
document[tagid].onmousedown = handler; |
document[tagid].onmousedown = handler; |
} |
} |
|
return true; |
} |
} |
|
|
function unregisterMouseDown(tagid, handler) { |
function unregisterMouseDown(tagid, handler) { |
Line 425 function unregisterMouseDown(tagid, hand
|
Line 476 function unregisterMouseDown(tagid, hand
|
} else { |
} else { |
document[tagid].releaseEvents(Event.MOUSEDOWN); |
document[tagid].releaseEvents(Event.MOUSEDOWN); |
} |
} |
|
return true; |
} |
} |
|
|
function registerMouseMove(tagid, handler) { |
function registerMouseMove(tagid, handler) { |
Line 437 function registerMouseMove(tagid, handle
|
Line 489 function registerMouseMove(tagid, handle
|
document[tagid].captureEvents(Event.MOUSEMOVE); |
document[tagid].captureEvents(Event.MOUSEMOVE); |
document[tagid].onmousemove = handler; |
document[tagid].onmousemove = handler; |
} |
} |
|
return true; |
} |
} |
|
|
function unregisterMouseMove(tagid, handler) { |
function unregisterMouseMove(tagid, handler) { |
Line 448 function unregisterMouseMove(tagid, hand
|
Line 501 function unregisterMouseMove(tagid, hand
|
} else { |
} else { |
document[tagid].releaseEvents(Event.MOUSEMOVE); |
document[tagid].releaseEvents(Event.MOUSEMOVE); |
} |
} |
|
return true; |
} |
} |
|
|
function registerKeyDown(handler) { |
function registerKeyDown(handler) { |
Line 460 function registerKeyDown(handler) {
|
Line 514 function registerKeyDown(handler) {
|
window.captureEvents(Event.KEYDOWN); |
window.captureEvents(Event.KEYDOWN); |
window.onkeydown = handler; |
window.onkeydown = handler; |
} |
} |
|
return true; |
} |
} |
|
|
function getWinSize() { |
function getWinSize() { |
Line 483 function getWinSize() {
|
Line 538 function getWinSize() {
|
|
|
function bestPicSize(tagid) { |
function bestPicSize(tagid) { |
// returns a Size with the best image size for the given tagid |
// returns a Size with the best image size for the given tagid |
var inset = 5; |
var inset = 0; |
var ps = getWinSize(); |
var ws = getWinSize(); |
var scaler = document.getElementById(tagid); |
var es = getElementSize(tagid); |
ps.width = ps.width - scaler.offsetLeft - inset; |
ws.width = ws.width - es.x - inset; |
ps.height = ps.height - scaler.offsetTop - inset; |
ws.height = ws.height - es.y - inset; |
return ps; |
return ws; |
} |
} |
|
|
|
|
Line 520 function display(detail) {
|
Line 575 function display(detail) {
|
} |
} |
|
|
|
|
/* |
|
* Point class |
|
*/ |
|
function Point() { |
|
} |
|
Point.prototype.setWithEvent = function(evt) { |
|
// set point values from event |
|
|
|
if ( document.all ) { |
|
|
|
this.pageX = parseInt(document.body.scrollLeft+event.clientX); |
|
this.pageY = parseInt(document.body.scrollLeft+event.clientY); |
|
|
|
this.x = this.pageX-parseInt(document.all.scaler.offsetLeft); |
|
this.y = this.pageY-parseInt(document.all.scaler.offsetTop); |
|
|
|
this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.all.scaler.offsetWidth)); |
|
this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.all.scaler.offsetHeight)); |
|
|
|
} else { |
|
|
|
this.pageX = parseInt(evt.pageX); |
|
this.pageY = parseInt(evt.pageY); |
|
|
|
if ( typeof(document.getElementById) == "function" ) { |
|
|
|
this.x = this.pageX-parseInt(document.getElementById("scaler").offsetLeft); |
|
this.y = this.pageY-parseInt(document.getElementById("scaler").offsetTop); |
|
// top("2"+"::"+this.pageX+"::"+parseInt(document.getElementById("scaler").offsetLeft)+'::'+document.getElementById("scaler").offsetLeft); |
|
this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.pic.offsetWidth)); |
|
this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.pic.offsetHeight)); |
|
|
|
} else { |
|
|
|
this.x = this.pageX-document.scaler.left; |
|
this.y = this.pageY-document.scaler.top; |
|
|
|
this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.scaler.clip.width)); |
|
this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.scaler.clip.height)); |
|
|
|
} |
|
|
|
} |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
function page(page, details) { |
function page(page, details) { |
|
|
Line 618 function mark() {
|
Line 625 function mark() {
|
function markEvent(evt) { |
function markEvent(evt) { |
// event handler adding a new mark |
// event handler adding a new mark |
unregisterMouseDown("scaler", markEvent); |
unregisterMouseDown("scaler", markEvent); |
var point = new Point(); |
var p = dlTrafo.invtransform(evtPosition(evt)); |
point.setWithEvent(evt); |
addMark(p); |
var point2 = dlTrafo.invtransform(new Position(point.x, point.y)); |
|
//alert("p0: "+point.x+", "+point.y); |
|
//alert("p1: "+point.relX+", "+point.relY+" p2: "+point2.x+", "+point2.y); |
|
var point3 = dlTrafo.transform(point2); |
|
//alert("p3: "+point3.x+", "+point3.y); |
|
//addMark(point.relX, point.relY); |
|
addMark(point2.x, point2.y); |
|
placeMarks(); |
placeMarks(); |
} |
} |
|
|
Line 648 function placeMarks() {
|
Line 648 function placeMarks() {
|
if (picelem && picelem.complete == false) { |
if (picelem && picelem.complete == false) { |
setTimeout("placeMarks()", 100); |
setTimeout("placeMarks()", 100); |
} else { |
} else { |
var picsize = getElementSize("scaler"); |
var picsize = getElementSize("pic"); |
dlTrafo = parseTrafo(); |
dlTrafo = parseTrafo(); |
for (var i = 0; i < 8; i++) { |
for (var i = 0; i < 8; i++) { |
if (i < mark_count) { |
if (i < mark_count) { |
if (dlArea.containsPosition(dlMarks[i])) { |
if (dlArea.containsPosition(dlMarks[i])) { |
var mpos = dlTrafo.transform(dlMarks[i]); |
var mpos = dlTrafo.transform(dlMarks[i]); |
//alert("mark: "+mpos.x+" "+mpos.y); |
|
// suboptimal to place -5 pixels and not half size of mark-image |
// suboptimal to place -5 pixels and not half size of mark-image |
mpos.x = mpos.x + picsize.x -5; |
mpos.x = mpos.x -5; |
mpos.y = mpos.y + picsize.y -5; |
mpos.y = mpos.y -5; |
moveElement("dot"+i, mpos); |
moveElement("dot"+i, mpos); |
showElement("dot"+i, true); |
showElement("dot"+i, true); |
} |
} |
Line 672 function placeMarks() {
|
Line 671 function placeMarks() {
|
|
|
function zoomPoint(inout) { |
function zoomPoint(inout) { |
// zoom image in or out around the clicked point |
// zoom image in or out around the clicked point |
window.focus(); |
|
var zoom = ZOOMFACTOR; |
var zoom = ZOOMFACTOR; |
if (inout < 0) { |
if (inout < 0) { |
zoom = 1/ZOOMFACTOR; |
zoom = 1/ZOOMFACTOR; |
} |
} |
|
window.focus(); |
|
|
function zoomPointEvent(evt) { |
function zoomPointEvent(evt) { |
// take new center and set zoom parameters |
// take new center and set zoom parameters |
var point = new Point(); |
var p = dlTrafo.invtransform(evtPosition(evt)); |
point.setWithEvent(evt); |
|
var neww = Math.min(dlArea.width * (1/zoom), 1.0); |
var neww = Math.min(dlArea.width * (1/zoom), 1.0); |
var newh = Math.min(dlArea.height * (1/zoom), 1.0); |
var newh = Math.min(dlArea.height * (1/zoom), 1.0); |
var newx = point.relX - 0.5 * neww; |
var newx = p.x - 0.5 * neww; |
var newy = point.relY - 0.5 * newh; |
var newy = p.y - 0.5 * newh; |
var zoomarea = new Rectangle(newx, newy, neww, newh); |
var zoomarea = new Rectangle(newx, newy, neww, newh); |
//alert("za1: "+zoomarea.x+","+zoomarea.y+" "+zoomarea.width+","+zoomarea.height); |
|
// check bounds |
// check bounds |
zoomarea = dlMaxArea.fit(zoomarea); |
zoomarea = dlMaxArea.fit(zoomarea); |
//alert("za2: "+zoomarea.x+","+zoomarea.y+" "+zoomarea.width+","+zoomarea.height); |
|
// set parameters |
// set parameters |
setParameter("wx", cropFloat(zoomarea.x)); |
setParameter("wx", cropFloat(zoomarea.x)); |
setParameter("wy", cropFloat(zoomarea.y)); |
setParameter("wy", cropFloat(zoomarea.y)); |
Line 699 function zoomPoint(inout) {
|
Line 695 function zoomPoint(inout) {
|
parseArea(); |
parseArea(); |
display(3); |
display(3); |
} |
} |
|
|
// starting event capture |
// starting event capture |
registerMouseDown("scaler", zoomPointEvent); |
registerMouseDown("scaler", zoomPointEvent); |
} |
} |
Line 715 function zoomArea() {
|
Line 712 function zoomArea() {
|
if (click == 1) { |
if (click == 1) { |
// first click -- start moving |
// first click -- start moving |
click = 2; |
click = 2; |
pt1 = new Point(); |
pt1 = evtPosition(evt); |
pt1.setWithEvent(evt); |
|
pt2 = pt1; |
pt2 = pt1; |
eck1pos = new Position(pt1.pageX, pt1.pageY); |
eck1pos = pt1; |
eck2pos = new Position(pt1.pageX - 12, pt1.pageY); |
eck2pos = new Position(pt1.x - 12, pt1.y); |
eck3pos = new Position(pt1.pageX, pt1.pageY - 12); |
eck3pos = new Position(pt1.x, pt1.y - 12); |
eck4pos = new Position(pt1.pageX- 12, pt1.pageY - 12); |
eck4pos = new Position(pt1.y - 12, pt1.y - 12); |
moveElement("eck1", eck1pos); |
moveElement("eck1", eck1pos); |
moveElement("eck2", eck2pos); |
moveElement("eck2", eck2pos); |
moveElement("eck3", eck3pos); |
moveElement("eck3", eck3pos); |
Line 734 function zoomArea() {
|
Line 730 function zoomArea() {
|
registerMouseMove("eck4", zoomMove); |
registerMouseMove("eck4", zoomMove); |
} else { |
} else { |
// second click -- end moving |
// second click -- end moving |
pt2 = new Point(); |
pt2 = evtPosition(evt); |
pt2.setWithEvent(evt); |
|
showElement("eck1", false); |
showElement("eck1", false); |
showElement("eck2", false); |
showElement("eck2", false); |
showElement("eck3", false); |
showElement("eck3", false); |
Line 744 function zoomArea() {
|
Line 739 function zoomArea() {
|
unregisterMouseMove("eck4", zoomMove); |
unregisterMouseMove("eck4", zoomMove); |
unregisterMouseDown("scaler", zoomClick); |
unregisterMouseDown("scaler", zoomClick); |
unregisterMouseDown("eck4", zoomClick); |
unregisterMouseDown("eck4", zoomClick); |
var ww = pt2.relX-pt1.relX; |
var p1 = dlTrafo.invtransform(pt1); |
var wh = pt2.relY-pt1.relY; |
var p2 = dlTrafo.invtransform(pt2); |
|
var ww = p2.x-p1.x; |
|
var wh = p2.y-p1.y; |
if ((ww > 0)&&(wh > 0)) { |
if ((ww > 0)&&(wh > 0)) { |
setParameter("wx", cropFloat(pt1.relX)); |
setParameter("wx", cropFloat(p1.x)); |
setParameter("wy", cropFloat(pt1.relY)); |
setParameter("wy", cropFloat(p1.y)); |
setParameter("ww", cropFloat(ww)); |
setParameter("ww", cropFloat(ww)); |
setParameter("wh", cropFloat(wh)); |
setParameter("wh", cropFloat(wh)); |
parseArea(); |
parseArea(); |
Line 759 function zoomArea() {
|
Line 756 function zoomArea() {
|
|
|
function zoomMove(evt) { |
function zoomMove(evt) { |
// mouse move handler |
// mouse move handler |
pt2 = new Point(); |
pt2 = evtPosition(evt); |
pt2.setWithEvent(evt); |
|
// restrict marks to move right and down |
// restrict marks to move right and down |
eck1pos = new Position(pt1.pageX, pt1.pageY); |
eck1pos = pt1; |
eck2pos = new Position(Math.max(pt1.pageX, pt2.pageX)-12, pt1.pageY); |
eck2pos = new Position(Math.max(pt1.x, pt2.x)-12, pt1.y); |
eck3pos = new Position(pt1.pageX, Math.max(pt1.pageY, pt2.pageY)-12); |
eck3pos = new Position(pt1.x, Math.max(pt1.y, pt2.y)-12); |
eck4pos = new Position(Math.max(pt1.pageX, pt2.pageX)-12, Math.max(pt1.pageY, pt2.pageY)-12); |
eck4pos = new Position(Math.max(pt1.x, pt2.x)-12, Math.max(pt1.y, pt2.y)-12); |
moveElement("eck1", eck1pos); |
moveElement("eck1", eck1pos); |
moveElement("eck2", eck2pos); |
moveElement("eck2", eck2pos); |
moveElement("eck3", eck3pos); |
moveElement("eck3", eck3pos); |
moveElement("eck4", eck4pos); |
moveElement("eck4", eck4pos); |
} |
} |
|
|
// starting event capture |
// starting event capture |
registerMouseDown("scaler", zoomClick); |
registerMouseDown("scaler", zoomClick); |
registerMouseDown("eck4", zoomClick); |
registerMouseDown("eck4", zoomClick); |
Line 789 function zoomFullpage() {
|
Line 786 function zoomFullpage() {
|
|
|
function moveTo() { |
function moveTo() { |
|
|
if ( (parseFloat(dlParams.ww.value) == 1.0) && (parseFloat(dlParams.wh.value) == 1.0) ) { |
if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { |
alert("This function is only available when zoomed in!"); |
alert("This function is only available when zoomed in!"); |
return; |
return; |
} |
} |
|
|
function moveToEvent(event) { |
function moveToEvent(event) { |
// move to handler |
// move to handler |
var point = new Point(); |
var pt = evtPosition(evt); |
point.setWithEvent(eventt); |
var newarea = new Rectangle(pt.x-0.5*dlArea.width, pt.y-0.5*dlArea.height, dlArea.width, dlArea.height); |
var newarea = new Rectangle(point.relX-0.5*dlParams.ww.value, point.relY-0.5*dlParams.wh.value, dlArea.width, dlArea.height); |
newarea = dlMaxArea.fit(newarea); |
newarea = dlMaxArea.intersect(newarea); |
|
// stopping event capture |
// stopping event capture |
unregisterMouseDown("scaler", moveToEvent); |
unregisterMouseDown("scaler", moveToEvent); |
// set parameters |
// set parameters |
Line 809 function moveTo() {
|
Line 805 function moveTo() {
|
setParameter("wh", cropFloat(newarea.height)); |
setParameter("wh", cropFloat(newarea.height)); |
display(3); |
display(3); |
} |
} |
|
|
// starting event capture |
// starting event capture |
registerMouseDown("scaler", moveToEvent); |
registerMouseDown("scaler", moveToEvent); |
} |
} |