thorvg.viewer icon indicating copy to clipboard operation
thorvg.viewer copied to clipboard

thorvg viewer content size looks incorrect

Open hermet opened this issue 6 months ago • 3 comments

1003x1003 between thorvg viewer / skottie. thorvg viewer looks much bigger.

Image

hermet avatar Jun 03 '25 12:06 hermet

@hermet I think skottie viewer's box is smaller than their size. When I set 1003 by 1003, it actually renders in 502 by 502 box.

Image

tinyjin avatar Jun 03 '25 14:06 tinyjin

I measured size by ruler tool, ThorVG viewer always shows proper size.

Image

tinyjin avatar Jun 03 '25 14:06 tinyjin

The DOM size is correct, as shown in the right panel. However, due to the device pixel ratio (DPR), the actual rendered size is multiplied, which results in a visual size that appears different to the human eye.

Skottie addresses this by dividing the canvas size by the DPR to maintain visual consistency. It would be good for us to apply the same DPR adjustment to our canvas size as well.

tinyjin avatar Jun 03 '25 15:06 tinyjin

@tinyjin Let's multply DPR to the viewer size so that it's based on pixel units.

hermet avatar Nov 27 '25 05:11 hermet