Inkscape moveTo在拉斐尔(Raphael)遥遥领先 [英] Inkscape moveTo coords way off in Raphael

查看:70
本文介绍了Inkscape moveTo在拉斐尔(Raphael)遥遥领先的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从inkscape复制路径到Raphael(单个国家/地区),问题是moveTo很远,如何使其显示在画布上相对正确的位置上?

解决方案

如果要在画布上的相对位置绘制路径,则需要将所有绝对坐标转换为相对坐标.最近我遇到了同样的问题,求助于计算器和纸(这是一条很短的路,以编程方式进行攻击是不值得的).那里有一些声称可以进行这些转换的工具,但以我的经验,它们要么是不完整的链接,要么是过时的链接.

问题是Inkscape已经为您决定要对SVG文件进行大小优化,并且只要节省几个字节,Inkscape就会从相对切换为绝对.本质上,您需要做的是遍历路径,跟踪位置,将每个绝对节点与上一个节点(或原点,如果是初始moveTo)进行比较,然后用差值替换任何绝对坐标./p>

Inkscape首选项具有强制绝对坐标的选项(取消选中首选项"->"SVG输出"->允许相对坐标"),这可能会使转换更加容易.

I am trying to copy paths from inkscape into Raphael (individual countries), the problem is the moveTo is way off, how do I make it display on the relatively correct position on the canvas?

解决方案

If you're trying to draw a path on a canvas in a relative position, you need to transform all of the absolute coordinates to relative coordinates. I had the same problem recently and resorted to a calculator and paper (it was a short path, and wasn't worth it to attack programatically). There are a few tools out there that claim to be able to do these transformations, but in my experience they were either incomplete or outdated links.

The problem is that Inkscape has already decided for you that you want your SVG files optimized for size, and will switch back and forth from relative to absolute whenever it would save a few bytes. Essentially, what you would need to do is iterate through the path, keeping track of your position, compare each absolute node to the previous node (or the origin, if it's the initial moveTo), and replace any absolute coordinates with the difference.

The Inkscape preferences have an option to force absolute coordinates, (uncheck Preferences->SVG Output->Allow relative coordinates) which may make the transformation a little easier.

这篇关于Inkscape moveTo在拉斐尔(Raphael)遥遥领先的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆