无法在Raphael中缩放多个路径? [英] Can't scale multiple paths in Raphael?

查看:279
本文介绍了无法在Raphael中缩放多个路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试使用SO上的当前顶部问题:使用raphael扩展多个路径< a>

I've tried using the current top Question on SO : Scaling multiple paths with raphael

...没有太多运气。我正在通过Raphael建立美国的地图,而地图非常好,我需要它大概是目前的大小的30%。

...without much luck. I'm building a map of the USA through Raphael and while the map is very nice, I need it to be probably 30% the size it is currently.

我是能够将初始Raphael画布上的attr更改为.5,但是只有每个单独的路径,而不是整个画布。我也试过使用javascript来缩放包含画布的div没有效果。

I was able to change the attr on the initial Raphael canvas to ".5" but that only sized each individual path instead of the whole canvas. I have also tried using javascript to scale the div containing the canvas to no avail.

路径:实际页面:
http:// praxxgray.com/am/rafe2/mapTest.html

javascript:
http://praxxgray.com/am/rafe2/js/initMap.js

javascript: http://praxxgray.com/am/rafe2/js/initMap.js

我是新的到拉斐尔,但我有老板呼吸下来我的脖子,让它工作。 Raphael地图下方的图片显示了我的目标大小。

I'm new to Raphael, but I have bosses breathing down my neck to get it working. The image beneath the Raphael map shows the size that I'm aiming for. I feel like I am close, perhaps I am calling the wrong object to be resized?

帮助我Obi Wan!

Help me Obi Wan!

谢谢!

推荐答案

将参数viewBox和preserveAspectRatio添加到SVG元素。我尝试添加这些参数,只是为了看看我是否设法改变大小,我做了。

Add the parameter viewBox and preserveAspectRatio to the SVG element. I tried adding these parameters, just to see if I managed to change the size, and I did.

<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
   viewBox="0 0 2500 3100" preserveAspectRatio="none">

详细了解viewBox属性此处

More about the viewBox attribute here.

这篇关于无法在Raphael中缩放多个路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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