防止拖拽关节JS

Lah*_*ore 5 css jointjs

我正在研究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;
}
Run Code Online (Sandbox Code Playgroud)

Hel*_*per -1

var paper = new joint.dia.Paper({
  el: $('#paper'),
  width: 400,
  height: 400,
  gridSize: 10,
  model: graph,
  interactive: false // <------
});
Run Code Online (Sandbox Code Playgroud)