Commit 84088aa2 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47712 954022d7-b5bf-4e40-9824-e11837661b57
parent b033cf85
......@@ -307,150 +307,6 @@ FontProperties.prototype = {
}
};
function Matrix() {
if ( !(this instanceof Matrix) ) {
return new Matrix();
}
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
return this;
}
Matrix.prototype = {
/** @type Matrix */
constructor: Matrix,
reset: function () {
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
},
assign: function (sx, shx, shy, sy, tx, ty) {
this.sx = sx;
this.shx = shx;
this.shy = shy;
this.sy = sy;
this.tx = tx;
this.ty = ty;
},
copyFrom: function (matrix) {
this.sx = matrix.sx;
this.shx = matrix.shx;
this.shy = matrix.shy;
this.sy = matrix.sy;
this.tx = matrix.tx;
this.ty = matrix.ty;
},
clone: function () {
var m = new Matrix();
m.copyFrom(this);
return m;
},
multiply: function (matrix, order) {
if (MATRIX_ORDER_PREPEND === order) {
var m = matrix.clone();
m.multiply(this, MATRIX_ORDER_APPEND);
this.copyFrom(m);
} else {
var t0 = this.sx * matrix.sx + this.shy * matrix.shx;
var t2 = this.shx * matrix.sx + this.sy * matrix.shx;
var t4 = this.tx * matrix.sx + this.ty * matrix.shx + matrix.tx;
this.shy = this.sx * matrix.shy + this.shy * matrix.sy;
this.sy = this.shx * matrix.shy + this.sy * matrix.sy;
this.ty = this.tx * matrix.shy + this.ty * matrix.sy + matrix.ty;
this.sx = t0;
this.shx = t2;
this.tx = t4;
}
},
translate: function (x, y, order) {
var m = new Matrix();
m.tx = x;
m.ty = y;
this.multiply(m, order);
},
scale: function (x, y, order) {
var m = new Matrix();
m.sx = x;
m.sy = y;
this.multiply(m, order);
},
rotate: function (a, order) {
var m = new Matrix();
var rad = deg2rad(a);
m.sx = Math.cos(rad);
m.shx = Math.sin(rad);
m.shy = -Math.sin(rad);
m.sy = Math.cos(rad);
this.multiply(m, order);
},
rotateAt: function (a, x, y, order) {
this.translate(-x, -y, order);
this.rotate(a, order);
this.translate(x, y, order);
},
determinant: function () {
return this.sx * this.sy - this.shy * this.shx;
},
invert: function () {
var det = this.determinant();
if (0.0001 > det) {return;}
var d = 1 / det;
var t0 = this.sy * d;
this.sy = this.sx * d;
this.shy = -this.shy * d;
this.shx = -this.shx * d;
var t4 = -this.tx * t0 - this.ty * this.shx;
this.ty = -this.tx * this.shy - this.ty * this.sy;
this.sx = t0;
this.tx = t4;
},
transformPointX: function (x, y) {
return x * this.sx + y * this.shx + this.tx;
},
transformPointY: function (x, y) {
return x * this.shy + y * this.sy + this.ty;
},
/** Calculates rotation angle */
getRotation: function () {
var x1 = 0.0;
var y1 = 0.0;
var x2 = 1.0;
var y2 = 0.0;
this.transformPoint(x1, y1);
this.transformPoint(x2, y2);
var a = Math.atan2(y2-y1, x2-x1);
return rad2deg(a);
}
};
function CMatrix()
{
this.sx = 1.0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment