- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这里我使用react-pan-zoom-svg并尝试在可缩放区域加载大型SVG
我遇到一些问题
1) 当svg
加载时,它不是从svg的中心点加载
2)当我移动SVG
时,它的矩阵值取负值
3) 无法适应屏幕
共享 jspaddel 无法正常工作,我无法解决它,但我的所有代码都在那里
请帮忙
提前谢谢
const {ReactSVGPanZoom} = window.ReactSVGPanZoom;
class Example extends React.Component{
render () {
return (
<ReactSVGPanZoom
width={window.innerWidth - 20} height={window.innerHeight - 20} scaleFactorMin={0.99}
onClick={event => console.log(event.x, event.y, event.originalEvent)}>
<svg width={4970} height={6480}>
<rect x="0" fill="#000003" stroke="#FF0000" strokeWidth="0.216" strokeMiterlimit="22.9256" width="4969.988" height="6480"/>
<g id="Layer_9">
<path id="M4_x5F_36" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3696.251,4110.594v101.864"/>
<path id="M4_x5F_35" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3696.251,3916.625v193.969"/>
<path id="M4_x5F_34" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3696.251,3802.334v114.291"/>
<path id="M4_x5F_33" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3696.251,3721.333v81.001"/>
<path id="M4_x5F_32" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3696.251,3519.798v201.535"/>
<path id="M4_x5F_31" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3498.39,3321.937l197.86,197.861 "/>
<path id="M4_x5F_30" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3392.493,3216.04 l105.897,105.896"/>
<path id="M4_x5F_29" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3392.493,3216.04l-43.478-43.478 "/>
<path id="M4_x5F_28" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3253.389,3076.938l95.626,95.625 "/>
<path id="M4_x5F_27" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3188.253,3011.8l65.137,65.137"/>
<path id="M4_x5F_26" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M3188.253,3011.8l-75.824-75.824"/>
<path id="M4_x5F_25" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2994.472,2818.021 l117.956,117.956"/>
<path id="M4_x5F_24" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2994.472,2818.021 l-48.396-48.396V2720.5"/>
<path id="M4_x5F_23" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2946.076,2531.275V2720.5"/>
<path id="M4_x5F_22" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2805.869,2531.275h140.207"/>
<path id="M4_x5F_21" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2699.912,2542.543l11.269-11.268 h94.688"/>
<path id="M4_x5F_20" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2645.904,2596.551l54.008-54.008 "/>
<path id="M4_x5F_19" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2561.827,2596.551h84.077"/>
<path id="M4_x5F_18" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2481.671,2596.551h80.156"/>
<path id="M4_x5F_17" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.021,2366.625v11.977h24.649 v217.949"/>
<path id="M4_x5F_16" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.021,2288.25v78.375"/>
<path id="M4_x5F_15" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.021,2233.313v54.938"/>
<path id="M4_x5F_14" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.021,2183.813v49.5"/>
<path id="M4_x5F_13" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.021,2183.813v-14.185 l45.986-45.99"/>
<path id="M4_x5F_12" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2503.008,2123.638l19.015-19.015 h61.123"/>
<path id="M4_x5F_11" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2583.145,2026.36v78.263"/>
<path id="M4_x5F_10" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2457.518,2026.36h125.627"/>
<path id="M4_x5F_9" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2366.921,1935.763l90.598,90.598"/>
<path id="M4_x5F_8" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2273.45,1842.293l93.471,93.47"/>
<path id="M4_x5F_7" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2212.099,1780.943l61.351,61.35"/>
<path id="M4_x5F_6" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2212.099,1780.943l-40.314-40.313 "/>
<path id="M4_x5F_5" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2132.488,1701.332l39.297,39.297"/>
<path id="M4_x5F_4" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2089.827,1658.67l42.661,42.662"/>
<path id="M4_x5F_3" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2052.288,1621.132l37.539,37.539"/>
<path id="M4_x5F_2" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M2015.544,1584.386l36.745,36.746"/>
<path id="M4_x5F_1" fill="none" stroke="#B21436" strokeWidth="1.5" strokeMiterlimit="10" d="M1857.804,1426.646l157.739,157.74 "/>
</g>
<g id="Layer_8">
<g>
<path fill="#B21436" d="M2583.687,2107.595c-1.638,0-2.97-1.332-2.97-2.97s1.332-2.97,2.97-2.97c1.637,0,2.969,1.332,2.969,2.97 S2585.324,2107.595,2583.687,2107.595z"/>
</g>
<path fill="#B21436" d="M2805.881,2534.248c-1.64,0-2.972-1.332-2.972-2.97s1.332-2.97,2.972-2.97c1.637,0,2.969,1.332,2.969,2.97 S2807.516,2534.248,2805.881,2534.248z"/>
<g>
<path fill="#B21436" d="M2583.686,2030.518c-1.636,0-2.967-1.331-2.967-2.967s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2585.322,2030.518,2583.686,2030.518z"/>
</g>
<g>
<path fill="#B21436" d="M2458.059,2030.518c-1.636,0-2.967-1.331-2.967-2.967s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2459.695,2030.518,2458.059,2030.518z"/>
</g>
<path fill="#B21436" d="M2457.562,2186.475c-1.636,0-2.967-1.332-2.967-2.968s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2459.198,2186.475,2457.562,2186.475z"/>
<path fill="#B21436" d="M2457.562,2236.268c-1.636,0-2.967-1.332-2.967-2.968s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2459.198,2236.268,2457.562,2236.268z"/>
<path fill="#B21436" d="M2457.562,2291.273c-1.636,0-2.967-1.332-2.967-2.968s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2459.198,2291.273,2457.562,2291.273z"/>
<circle fill="#B21436" cx="2700.288" cy="2542.87" r="2.969"/>
<circle fill="#B21436" cx="2646.456" cy="2596.553" r="2.969"/>
<path fill="#B21436" d="M2561.969,2599.521c-1.637,0-2.969-1.332-2.969-2.97c0-1.637,1.332-2.969,2.969-2.969 c1.638,0,2.97,1.332,2.97,2.969C2564.939,2598.189,2563.607,2599.521,2561.969,2599.521z"/>
<path fill="#B21436" d="M2457.562,2369.464c-1.636,0-2.967-1.331-2.967-2.967s1.331-2.967,2.967-2.967s2.967,1.331,2.967,2.967 S2459.198,2369.464,2457.562,2369.464z"/>
<g>
<path fill="#B21436" d="M2482.21,2599.52c-1.636,0-2.968-1.33-2.968-2.967c0-1.636,1.332-2.967,2.968-2.967 c1.637,0,2.968,1.331,2.968,2.967C2485.177,2598.189,2483.845,2599.52,2482.21,2599.52z"/>
</g>
<g>
<path fill="#B21436" d="M2503.431,2126.729c-1.638,0-2.968-1.332-2.968-2.968s1.33-2.968,2.968-2.968 c1.637,0,2.968,1.332,2.968,2.968S2505.068,2126.729,2503.431,2126.729z"/>
</g>
<path fill="#B21436" d="M2946.619,2534.248c-1.637,0-2.969-1.332-2.969-2.97s1.332-2.97,2.969-2.97c1.638,0,2.97,1.332,2.97,2.97 S2948.258,2534.248,2946.619,2534.248z"/>
<g>
<path fill="#B21436" d="M2946.61,2723.278c-1.637,0-2.968-1.332-2.968-2.968c0-1.638,1.331-2.97,2.968-2.97 s2.969,1.332,2.969,2.97C2949.579,2721.947,2948.247,2723.278,2946.61,2723.278z"/>
</g>
<g>
<path fill="#B21436" d="M2994.676,2820.653c-1.636,0-2.968-1.332-2.968-2.968c0-1.637,1.332-2.968,2.968-2.968 s2.967,1.331,2.967,2.968C2997.641,2819.322,2996.31,2820.653,2994.676,2820.653z"/>
</g>
<path fill="#B21436" d="M3112.772,2938.729c-1.637,0-2.968-1.332-2.968-2.969c0-1.636,1.331-2.968,2.968-2.968 s2.968,1.332,2.968,2.968C3115.74,2937.396,3114.409,2938.729,3112.772,2938.729z"/>
<g>
<path fill="#B21436" d="M3188.532,3014.521c-1.637,0-2.968-1.332-2.968-2.969c0-1.636,1.331-2.968,2.968-2.968 s2.969,1.332,2.969,2.968C3191.501,3013.189,3190.169,3014.521,3188.532,3014.521z"/>
</g>
<g>
<path fill="#B21436" d="M3253.472,3079.457c-1.638,0-2.968-1.331-2.968-2.967c0-1.637,1.33-2.967,2.968-2.967 c1.636,0,2.967,1.33,2.967,2.967C3256.439,3078.126,3255.108,3079.457,3253.472,3079.457z"/>
</g>
<g>
<path fill="#B21436" d="M3349.292,3175.286c-1.637,0-2.968-1.331-2.968-2.968c0-1.636,1.331-2.968,2.968-2.968 s2.968,1.332,2.968,2.968C3352.26,3173.955,3350.927,3175.286,3349.292,3175.286z"/>
</g>
<g>
<path fill="#B21436" d="M3392.807,3218.786c-1.636,0-2.967-1.331-2.967-2.968c0-1.636,1.331-2.968,2.967-2.968 s2.967,1.332,2.967,2.968C3395.774,3217.455,3394.443,3218.786,3392.807,3218.786z"/>
</g>
<g>
<path fill="#B21436" d="M3498.712,3324.697c-1.636,0-2.967-1.332-2.967-2.969s1.331-2.967,2.967-2.967 c1.638,0,2.969,1.33,2.969,2.967C3501.679,3323.365,3500.348,3324.697,3498.712,3324.697z"/>
</g>
<g>
<path fill="#B21436" d="M3696.788,3724.678c-1.637,0-2.968-1.332-2.968-2.967c0-1.637,1.331-2.967,2.968-2.967 s2.968,1.33,2.968,2.967C3699.756,3723.346,3698.425,3724.678,3696.788,3724.678z"/>
</g>
<g>
<path fill="#B21436" d="M3696.788,3805.133c-1.637,0-2.968-1.332-2.968-2.967c0-1.637,1.331-2.967,2.968-2.967 s2.968,1.33,2.968,2.967C3699.756,3803.801,3698.425,3805.133,3696.788,3805.133z"/>
</g>
<g>
<path fill="#B21436" d="M3696.788,3919.344c-1.637,0-2.968-1.332-2.968-2.967c0-1.637,1.331-2.967,2.968-2.967 s2.968,1.33,2.968,2.967C3699.756,3918.012,3698.425,3919.344,3696.788,3919.344z"/>
</g>
<g>
<path fill="#B21436" d="M3696.788,4113.354c-1.637,0-2.968-1.332-2.968-2.967c0-1.637,1.331-2.967,2.968-2.967 s2.968,1.33,2.968,2.967C3699.756,4112.021,3698.425,4113.354,3696.788,4113.354z"/>
</g>
<g>
<path fill="#B21436" d="M3696.413,4214.142c-1.637,0-2.968-1.332-2.968-2.967c0-1.637,1.331-2.967,2.968-2.967 s2.968,1.33,2.968,2.967C3699.381,4212.81,3698.05,4214.142,3696.413,4214.142z"/>
</g>
<g>
<path fill="#B21436" d="M3696.792,3522.764c-1.636,0-2.967-1.332-2.967-2.967c0-1.637,1.331-2.967,2.967-2.967 c1.638,0,2.969,1.33,2.969,2.967C3699.76,3521.432,3698.428,3522.764,3696.792,3522.764z"/>
</g>
<path fill="#B21436" d="M1858.345,1429.613c-1.636,0-2.968-1.331-2.968-2.967c0-1.637,1.332-2.969,2.968-2.969 s2.967,1.332,2.967,2.969C1861.312,1428.282,1859.981,1429.613,1858.345,1429.613z"/>
<path fill="#B21436" d="M2015.488,1587.447c-1.636,0-2.968-1.332-2.968-2.969s1.332-2.969,2.968-2.969s2.968,1.332,2.968,2.969 C2018.456,1586.116,2017.124,1587.447,2015.488,1587.447z"/>
<path fill="#B21436" d="M2052.195,1624.158c-1.636,0-2.967-1.331-2.967-2.967c0-1.637,1.331-2.969,2.967-2.969 s2.968,1.332,2.968,2.969C2055.163,1622.827,2053.831,1624.158,2052.195,1624.158z"/>
<path fill="#B21436" d="M2090.087,1661.352c-1.637,0-2.969-1.332-2.969-2.969c0-1.636,1.332-2.968,2.969-2.968 s2.969,1.332,2.969,2.968C2093.054,1660.02,2091.723,1661.352,2090.087,1661.352z"/>
<path fill="#B21436" d="M2132.844,1704.112c-1.637,0-2.967-1.332-2.967-2.968c0-1.637,1.33-2.968,2.967-2.968 c1.636,0,2.967,1.331,2.967,2.968S2134.48,1704.112,2132.844,1704.112z"/>
<path fill="#B21436" d="M2171.967,1743.355c-1.638,0-2.97-1.332-2.97-2.97c0-1.636,1.332-2.968,2.97-2.968 c1.636,0,2.968,1.332,2.968,2.968C2174.933,1742.024,2173.602,1743.355,2171.967,1743.355z"/>
<path fill="#B21436" d="M2212.559,1783.287c-1.636,0-2.967-1.331-2.967-2.967c0-1.637,1.331-2.969,2.967-2.969 s2.967,1.332,2.967,2.969C2215.526,1781.956,2214.195,1783.287,2212.559,1783.287z"/>
<path fill="#B21436" d="M2273.734,1844.998c-1.636,0-2.967-1.331-2.967-2.967c0-1.637,1.331-2.967,2.967-2.967 s2.968,1.33,2.968,2.967C2276.702,1843.667,2275.37,1844.998,2273.734,1844.998z"/>
<path fill="#B21436" d="M2367.177,1938.439c-1.637,0-2.967-1.332-2.967-2.968s1.33-2.967,2.967-2.967 c1.636,0,2.967,1.331,2.967,2.967C2370.143,1937.109,2368.812,1938.439,2367.177,1938.439z"/>
<rect x="204.085" y="190.131" fill="#B21436" width="51.005" height="51.005"/>
</g>
</svg>
</ReactSVGPanZoom>
);
}
}
ReactDOM.render(
<div><Example /></div>,
document.getElementById('container')
);
body {
margin: 0;
background-color: rgba(0, 0, 0, 0.05);
background-image: repeating-linear-gradient(0deg, transparent, transparent 7px, rgba(0, 0, 0, 0.2) 1px, transparent 8px), repeating-linear-gradient(90deg, transparent, transparent 7px, rgba(0, 0, 0, 0.2) 1px, transparent 8px);
background-size: 8px 8px;
}
#container {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
}
<script src="https://unpkg.com/react-svg-pan-zoom@2.16.1/build-umd/react-svg-pan-zoom.min.js"></script>
<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
<script src="https://unpkg.com/react-dom@15.5.4/dist/react-dom.js"></script>
<script src="https://unpkg.com/react@15.5.4/dist/react.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<div id="container"></div>
最佳答案
不确定您想要实现什么以及您如何决定这些“固定宽度和高度。
但这是代码的工作版本: https://jsfiddle.net/tzookb/79742ncq/
现在请定义您想要实现的目标,以便我可以提供帮助。
我已经与 svg 和 React 对抗了很长时间。
快速更新您的代码:
const width = window.innerWidth - 20;
const height= window.innerHeight - 20;
return (
<ReactSVGPanZoom
width={width} height={height} scaleFactorMin={0.99}
onClick={event => console.log(event.x, event.y, event.originalEvent)}>
关于jquery - 大尺寸的 svg 无法正常工作如何在 React-pan-zoon-svg 中设置大 svg?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50059042/
我需要将文本放在 中在一个 Div 中,在另一个 Div 中,在另一个 Div 中。所以这是它的样子: #document Change PIN
奇怪的事情发生了。 我有一个基本的 html 代码。 html,头部, body 。(因为我收到了一些反对票,这里是完整的代码) 这是我的CSS: html { backgroun
我正在尝试将 Assets 中的一组图像加载到 UICollectionview 中存在的 ImageView 中,但每当我运行应用程序时它都会显示错误。而且也没有显示图像。 我在ViewDidLoa
我需要根据带参数的 perl 脚本的输出更改一些环境变量。在 tcsh 中,我可以使用别名命令来评估 perl 脚本的输出。 tcsh: alias setsdk 'eval `/localhome/
我使用 Windows 身份验证创建了一个新的 Blazor(服务器端)应用程序,并使用 IIS Express 运行它。它将显示一条消息“Hello Domain\User!”来自右上方的以下 Ra
这是我的方法 void login(Event event);我想知道 Kotlin 中应该如何 最佳答案 在 Kotlin 中通配符运算符是 * 。它指示编译器它是未知的,但一旦知道,就不会有其他类
看下面的代码 for story in book if story.title.length < 140 - var story
我正在尝试用 C 语言学习字符串处理。我写了一个程序,它存储了一些音乐轨道,并帮助用户检查他/她想到的歌曲是否存在于存储的轨道中。这是通过要求用户输入一串字符来完成的。然后程序使用 strstr()
我正在学习 sscanf 并遇到如下格式字符串: sscanf("%[^:]:%[^*=]%*[*=]%n",a,b,&c); 我理解 %[^:] 部分意味着扫描直到遇到 ':' 并将其分配给 a。:
def char_check(x,y): if (str(x) in y or x.find(y) > -1) or (str(y) in x or y.find(x) > -1):
我有一种情况,我想将文本文件中的现有行包含到一个新 block 中。 line 1 line 2 line in block line 3 line 4 应该变成 line 1 line 2 line
我有一个新项目,我正在尝试设置 Django 调试工具栏。首先,我尝试了快速设置,它只涉及将 'debug_toolbar' 添加到我的已安装应用程序列表中。有了这个,当我转到我的根 URL 时,调试
在 Matlab 中,如果我有一个函数 f,例如签名是 f(a,b,c),我可以创建一个只有一个变量 b 的函数,它将使用固定的 a=a1 和 c=c1 调用 f: g = @(b) f(a1, b,
我不明白为什么 ForEach 中的元素之间有多余的垂直间距在 VStack 里面在 ScrollView 里面使用 GeometryReader 时渲染自定义水平分隔线。 Scrol
我想知道,是否有关于何时使用 session 和 cookie 的指南或最佳实践? 什么应该和什么不应该存储在其中?谢谢! 最佳答案 这些文档很好地了解了 session cookie 的安全问题以及
我在 scipy/numpy 中有一个 Nx3 矩阵,我想用它制作一个 3 维条形图,其中 X 轴和 Y 轴由矩阵的第一列和第二列的值、高度确定每个条形的 是矩阵中的第三列,条形的数量由 N 确定。
假设我用两种不同的方式初始化信号量 sem_init(&randomsem,0,1) sem_init(&randomsem,0,0) 现在, sem_wait(&randomsem) 在这两种情况下
我怀疑该值如何存储在“WORD”中,因为 PStr 包含实际输出。? 既然Pstr中存储的是小写到大写的字母,那么在printf中如何将其给出为“WORD”。有人可以吗?解释一下? #include
我有一个 3x3 数组: var my_array = [[0,1,2], [3,4,5], [6,7,8]]; 并想获得它的第一个 2
我意识到您可以使用如下方式轻松检查焦点: var hasFocus = true; $(window).blur(function(){ hasFocus = false; }); $(win
我是一名优秀的程序员,十分优秀!