我正在研究 JointJS API。但是我想防止元素从它们的原始位置移动。您能否建议我使用 JointJS 的一些特性或一般的 CSS 的任何特性,我可以用它们来使我的对象不可移动。
我不能在论文或论文上使用interactive: false 选项。$el.css('pointer-events', 'none'); 因为当鼠标悬停在元素上时我需要突出显示功能。
请提出一种在允许其他功能的同时禁用元素移动的方法。相关的CSS代码片段如下:
.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;
}