comparison webapp/src/main/webapp/jquery/jquery.digilib.geometry.js @ 944:3916303b8f17

"preview" works now also for zoomIn/Out
author robcast
date Wed, 28 Dec 2011 22:04:18 +0100
parents 7779b37d1d05
children 3d5e7458f9ae
comparison
equal deleted inserted replaced
943:79cbc4694b14 944:3916303b8f17
85 return position({ 85 return position({
86 x : other.x - this.x, 86 x : other.x - this.x,
87 y : other.y - this.y 87 y : other.y - this.y
88 }); 88 });
89 }; 89 };
90 // adjusts position $elem to this position 90 // adjusts CSS position of $elem to this position
91 that.adjustDiv = function($elem) { 91 that.adjustDiv = function($elem) {
92 $elem.offset({ 92 $elem.offset({
93 left : this.x, 93 left : this.x,
94 top : this.y 94 top : this.y
95 }); 95 });
208 that.setCenter = function(pos) { 208 that.setCenter = function(pos) {
209 this.x = pos.x - this.width / 2; 209 this.x = pos.x - this.width / 2;
210 this.y = pos.y - this.height / 2; 210 this.y = pos.y - this.height / 2;
211 return this; 211 return this;
212 }; 212 };
213 // returns true if both rectangles have equal position and proportion 213 // returns true if both rectangles have equal position and size
214 that.equals = function(other) { 214 that.equals = function(other) {
215 var eq = (this.x === other.x && this.y === other.y && this.width === other.width); 215 var eq = (this.x === other.x && this.y === other.y && this.width === other.width);
216 return eq; 216 return eq;
217 };
218 // returns a rectangle with the difference width, height and position
219 that.delta = function(other) {
220 return rectangle(other.x - this.x, other.y - this.y,
221 other.width - this.width, other.height - this.height);
217 }; 222 };
218 // returns the area of this Rectangle 223 // returns the area of this Rectangle
219 that.getArea = function() { 224 that.getArea = function() {
220 return (this.width * this.height); 225 return (this.width * this.height);
221 }; 226 };