Fixed setGState, viewport transform

This commit is contained in:
pramodhkp 2014-07-05 14:18:11 +05:30
parent a55c9856e9
commit 2380b38b27

View File

@ -25,8 +25,7 @@ function createScratchSVG(width, height) {
svg.setAttributeNS(null, 'version', '1.1'); svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px'); svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px'); svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'viewBox', '0 ' + (-height) + ' ' + svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
width + ' ' + height);
return svg; return svg;
} }
@ -203,8 +202,8 @@ var SVGGraphics = (function SVGGraphicsClosure(ctx) {
this.viewport = viewport; this.viewport = viewport;
this.transformMatrix = IDENTITY_MATRIX; this.transformMatrix = IDENTITY_MATRIX;
this.pgrp = document.createElementNS(NS, 'svg:g'); // Parent group this.pgrp = document.createElementNS(NS, 'svg:g'); // Parent group
this.pgrp.setAttributeNS(null, 'transform', 'scale(' + viewport.scale + this.pgrp.setAttributeNS(null, 'transform',
',' + -viewport.scale + ')'); 'matrix(' + viewport.transform +')');
this.tgrp = document.createElementNS(NS, 'svg:g'); // Transform group this.tgrp = document.createElementNS(NS, 'svg:g'); // Transform group
this.tgrp.setAttributeNS(null, 'transform', this.tgrp.setAttributeNS(null, 'transform',
'matrix(' + this.transformMatrix +')'); 'matrix(' + this.transformMatrix +')');
@ -304,7 +303,7 @@ var SVGGraphics = (function SVGGraphicsClosure(ctx) {
this.setDash(args[0], args[1]); this.setDash(args[0], args[1]);
break; break;
case OPS.setGState: case OPS.setGState:
this.setGState(args); this.setGState(args[0]);
break; break;
case OPS.fill: case OPS.fill:
this.fill(); this.fill();
@ -690,7 +689,7 @@ var SVGGraphics = (function SVGGraphicsClosure(ctx) {
case 'FL': case 'FL':
break; break;
case 'Font': case 'Font':
this.setFont(value[0], value[1]); this.setFont(value);
break; break;
case 'CA': case 'CA':
break; break;