Opened 7 years ago

Closed 3 years ago

#14558 closed defect (patchwelcome)

VML doesn't apply scale transform to stroke

Reported by: stelapad Owned by: Eugene Lazutkin
Priority: high Milestone: 1.13
Component: DojoX GFX Version: 1.7.1
Keywords: vml stroke scale transform Cc:
Blocked By: Blocking:

Description

VML doesn't apply scale transform to stroke.

Test case:

  1. Open dojox/gfx/demos/data/transform.json
  2. Change lines 1533-1540 to:

"transform": {

"xx": 0.4, "xy": 0, "yx": 0, "yy": 0.4, "dx": 0, "dy": 0

},

  1. Change line 1550 to:

"width": 10,

  1. Run inspector.html and load transform.json, then select "rotated group/blue path"

SVG renderer will show a normal scaled-down blue path as expected. VML renderer scales down path but does not also scale down stroke so path stroke is super thick.

Another test case example (SVG stroke will be thickened as expected but VML will not):

  1. Change lines 1533-1540 to:

"transform": {

"xx":2, "xy": 0, "yx": 0, "yy": 2, "dx": -400, "dy": -200

},

  1. Change line 1550 to:

"width": 5,

Once again the SVG renderer correctly scales up the stroke but VML renderer does not.

Here's my interim fix if it helps at all:

  1. Open vml.js
  2. In the "dojox.gfx.vml.Shape" section:
    1. Update the "setStroke" function (for transforms applied directly to shape):

... rn.strokecolor = s.color.toCss(); var matrix = this._getRealMatrix(); if (!this.ranOnce && this.strokeStyle && matrix && matrix.xx && matrix.xx !== 1 && matrix.yy && matrix.xx === matrix.yy) {

this.strokeStyle.width = Math.ceil(this.strokeStyle.width * matrix.xx); this.ranOnce = true; this.setStroke(this.strokeStyle);

} rn.strokeweight = s.width + "px"; ...

  1. Update the "_applyTransform" function (for transforms applied to group):

... var matrix = this._getRealMatrix(); if (!this.ranOnce && this.strokeStyle && matrix && matrix.xx && matrix.xx !== 1 && matrix.yy && matrix.xx === matrix.yy) {

this.strokeStyle.width = Math.ceil(this.strokeStyle.width * matrix.xx); this.ranOnce = true; this.setStroke(this.strokeStyle);

} if(matrix){ ...

Change History (1)

comment:1 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 3+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.