【发布时间】:2014-05-27 09:22:52
【问题描述】:
我正在研究 JointJS API。但是我想防止元素从它们的原始位置移动。您能否建议我使用 JointJS 的一些功能或一般的 CSS 的任何功能,我可以使用它们来使我的对象不可移动。
我不能在纸上使用 interactive: false option 或 paper.$el.css('pointer-events', 'none'); 因为我当鼠标悬停在元素上时需要具有突出显示功能。
请提出一种在允许其他功能的同时禁止元素移动的方法。相关CSS代码sn-p如下:
.viewport {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.element {
/* Give the user a hint that he can drag&drop the element. */
cursor: crosshair;
position: fixed;
}
.element * {
/* The default behavior when scaling an element is not to scale the stroke in order to prevent the ugly effect of stroke with different proportions. */
vector-effect: non-scaling-stroke;
-moz-user-select: none;
user-drag: none;
position: fixed;
}
【问题讨论】:
-
你能告诉我们一些你尝试过的东西,或者一些示例代码吗?
-
嘿,我已经编辑了这个问题。请看一下:)
-
嗨,您有没有找到解决问题的方法?