Commit b5715fba authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

graphics/DrawingContext.js canvas jquery -> canvas

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53396 954022d7-b5bf-4e40-9824-e11837661b57
parent e09a8a7f
...@@ -453,7 +453,7 @@ DrawingContext.prototype = { ...@@ -453,7 +453,7 @@ DrawingContext.prototype = {
*/ */
getWidth: function (units) { getWidth: function (units) {
var i = units >= 0 && units <=3 ? units : this.units; var i = units >= 0 && units <=3 ? units : this.units;
return this.canvas[0].width * getCvtRatio(0/*px*/, i, this.ppiX); return this.canvas.width * getCvtRatio(0/*px*/, i, this.ppiX);
}, },
/** /**
...@@ -463,7 +463,7 @@ DrawingContext.prototype = { ...@@ -463,7 +463,7 @@ DrawingContext.prototype = {
*/ */
getHeight: function (units) { getHeight: function (units) {
var i = units >= 0 && units <=3 ? units : this.units; var i = units >= 0 && units <=3 ? units : this.units;
return this.canvas[0].height * getCvtRatio(0/*px*/, i, this.ppiY); return this.canvas.height * getCvtRatio(0/*px*/, i, this.ppiY);
}, },
/** /**
...@@ -471,7 +471,7 @@ DrawingContext.prototype = { ...@@ -471,7 +471,7 @@ DrawingContext.prototype = {
* @type {Element} * @type {Element}
*/ */
getCanvas: function () { getCanvas: function () {
return this.canvas[0]; return this.canvas;
}, },
/** /**
...@@ -479,10 +479,9 @@ DrawingContext.prototype = { ...@@ -479,10 +479,9 @@ DrawingContext.prototype = {
* @param canvas * @param canvas
*/ */
setCanvas: function (canvas) { setCanvas: function (canvas) {
var c = canvas !== undefined ? canvas : null; if (null == canvas) {return;}
if (c === null) {return;} this.canvas = canvas;
this.canvas = $(c); this.ctx = this.canvas.getContext("2d");
this.ctx = c.getContext("2d");
if (this.ctx.mozImageSmoothingEnabled) { if (this.ctx.mozImageSmoothingEnabled) {
this.ctx.mozImageSmoothingEnabled = false; this.ctx.mozImageSmoothingEnabled = false;
} }
...@@ -563,11 +562,11 @@ DrawingContext.prototype = { ...@@ -563,11 +562,11 @@ DrawingContext.prototype = {
resetSize: function (width, height) { resetSize: function (width, height) {
var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ), var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) ); h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
if (w !== this.canvas[0].width) { if (w !== this.canvas.width) {
this.canvas[0].width = w; this.canvas.width = w;
} }
if (h !== this.canvas[0].height) { if (h !== this.canvas.height) {
this.canvas[0].height = h; this.canvas.height = h;
} }
return this; return this;
}, },
...@@ -580,11 +579,11 @@ DrawingContext.prototype = { ...@@ -580,11 +579,11 @@ DrawingContext.prototype = {
expand: function (width, height) { expand: function (width, height) {
var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ), var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) ); h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
if (w > this.canvas[0].width) { if (w > this.canvas.width) {
this.canvas[0].width = w; this.canvas.width = w;
} }
if (h > this.canvas[0].height) { if (h > this.canvas.height) {
this.canvas[0].height = h; this.canvas.height = h;
} }
return this; return this;
}, },
......
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