Avoid sub-pixel antialiasing when drawing straight vertical or horizontal lines.

This commit is contained in:
kangax 2012-01-15 12:46:52 -05:00
parent 23c4ec2068
commit 1c8b5c122d
6 changed files with 10 additions and 12 deletions

View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2011, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.7.10" };
var fabric = fabric || { version: "0.7.11" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;

9
dist/all.js vendored
View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2011, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.7.10" };
var fabric = fabric || { version: "0.7.11" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;
@ -8287,8 +8287,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
ctx.beginPath();
// move from center (of virtual box) to its left/top corner
ctx.moveTo(-this.width / 2, -this.height / 2);
ctx.lineTo(this.width / 2, this.height / 2);
ctx.moveTo(this.width === 1 ? 0 : (-this.width / 2), this.height === 1 ? 0 : (-this.height / 2));
ctx.lineTo(this.width === 1 ? 0 : (this.width / 2), this.height === 1 ? 0 : (this.height / 2));
ctx.lineWidth = this.strokeWidth;
@ -8330,7 +8330,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
* @return {string} svg representation of an instance
*/
toSVG: function() {
console.log()
return [
'<line ',
'x1="', this.get('x1'), '" ',
@ -11705,7 +11704,7 @@ fabric.Image.filters.Invert.fromObject = function() {
textAndBg = this._getSVGTextAndBg(lineTopOffset, textLeftOffset, textLines),
shadowSpans = this._getSVGShadows(lineTopOffset, textLines);
return [
'<g transform="', this.getSvgTransform(), '">',
textAndBg.textBgRects.join(''),

4
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "0.7.10",
"version": "0.7.11",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
"repository": "git://github.com/kangax/fabric.js",

View file

@ -72,8 +72,8 @@
ctx.beginPath();
// move from center (of virtual box) to its left/top corner
ctx.moveTo(-this.width / 2, -this.height / 2);
ctx.lineTo(this.width / 2, this.height / 2);
ctx.moveTo(this.width === 1 ? 0 : (-this.width / 2), this.height === 1 ? 0 : (-this.height / 2));
ctx.lineTo(this.width === 1 ? 0 : (this.width / 2), this.height === 1 ? 0 : (this.height / 2));
ctx.lineWidth = this.strokeWidth;
@ -115,7 +115,6 @@
* @return {string} svg representation of an instance
*/
toSVG: function() {
console.log()
return [
'<line ',
'x1="', this.get('x1'), '" ',