首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WheelNav.js SVG阿拉伯文本包装

WheelNav.js SVG阿拉伯文本包装
EN

Stack Overflow用户
提问于 2017-04-30 10:47:04
回答 1查看 478关注 0票数 0

我有一些用阿拉伯语写的文本,在wheelnav.js导航项中有一点小问题,下面是一个jsFiddle:

WheelNav.js阿拉伯语文本包装问题jsFiddle

我一直在考虑注入一个SVG 前端,希望它能够解决这个问题,我知道如何做,但不是确切地在wheelnav.js的哪个部分去做,下面是mozilla的一个示例代码:

代码语言:javascript
复制
<svg width="400px" height="300px" viewBox="0 0 400 300"
     xmlns="http://www.w3.org/2000/svg">
  <desc>This example uses the 'switch' element to provide a 
        fallback graphical representation of a paragraph, if 
        XHTML is not supported.</desc>

  <switch>


    <foreignObject width="100" height="50"
                   requiredExtensions="http://www.w3.org/1999/xhtml">
      <!-- XHTML content goes here -->
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>Here is a paragraph that requires word wrap</p>
      </body>
    </foreignObject>

    <text font-size="10" font-family="Verdana">
      <tspan x="10" y="10">Here is a paragraph that</tspan>
      <tspan x="10" y="20">requires word wrap.</tspan>
    </text>
  </switch>
 </svg>

我很感激我能得到的任何帮助,甚至是其他的解决方案。

EN

回答 1

Stack Overflow用户

发布于 2017-05-09 19:58:28

为此,您可以在这里修改wheelnav.js:

代码语言:javascript
复制
//Title defined by path
if (wheelnavTitle().isPathTitle(this.title)) {
    this.navTitle = this.wheelnav.raphael.path(currentTitle.path);
}
//Title defined by image
else if (wheelnavTitle().isImageTitle(this.title)) {
    this.navTitle = this.wheelnav.raphael.image(currentTitle.src, sliceInitPath.titlePosX - (this.titleWidth / 2), sliceInitPath.titlePosY - (this.titleHeight / 2), this.titleWidth, this.titleHeight);
}
//Title defined by text
else {
    this.navTitle = this.wheelnav.raphael.text(sliceInitPath.titlePosX, sliceInitPath.titlePosY, currentTitle.title);
}

您必须为前台添加另一个分支。

您可以找到源这里

我找到了一个有用的GitHubGist

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43705552

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档