Closed Antoninecek closed 2 years ago
it was because using
.canvas {
position: inherit !important;
}
you need wrapper canvas with this style
html,
body,
#root {
height: 100%;
padding: 0;
margin: 0;
}
I resolve it with absolute position
.app-wrapper {
position: 'relative';
width: '100%';
height: 100%
}
.canvas-wrapper {
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
display: flex;
position: absolute;
background-size: 50px 50px;
background-color: #9e9e9e;
background-image: linear-gradient( 0deg, transparent 24%, rgba(250, 250, 250, 0.05) 25%, rgba(250, 250, 250, 0.05) 26%, transparent 27%, transparent 74%, rgba(250, 250, 250, 0.05) 75%, rgba(250, 250, 250, 0.05) 76%, transparent 77%, transparent ), linear-gradient( 90deg, transparent 24%, rgba(250, 250, 250, 0.05) 25%, rgba(250, 250, 250, 0.05) 26%, transparent 27%, transparent 74%, rgba(250, 250, 250, 0.05) 75%, rgba(250, 250, 250, 0.05) 76%, transparent 77%, transparent );
}
render () {
return <div className='app-wrapper'>
<div className='canvas-wrapper'>
<CanvasWidget engine={engine} />
</div>
</div>
}
I'm also experiencing similar behavior, still trying to track down root cause
I still don't know the root cause but in the case i'm testing i found that sometimes DragCanvasState.fireMouseMoved gets called before this.initialCanvasX
and this.initialCanvasY
has been defined, which causes the call to setOffset
to be called with NaN
I'm not that familiar with the code so this might be a red herring, maybe @dylanvorster can shed some more light as to what might be happening here.
it was because using
.canvas { position: inherit !important; }
you need wrapper canvas with this style
html, body, #root { height: 100%; padding: 0; margin: 0; }
I resolve it with absolute position
.app-wrapper { position: 'relative'; width: '100%'; height: 100% } .canvas-wrapper { top: 0; left: 0; right: 0; bottom: 0; height: 100%; display: flex; position: absolute; background-size: 50px 50px; background-color: #9e9e9e; background-image: linear-gradient( 0deg, transparent 24%, rgba(250, 250, 250, 0.05) 25%, rgba(250, 250, 250, 0.05) 26%, transparent 27%, transparent 74%, rgba(250, 250, 250, 0.05) 75%, rgba(250, 250, 250, 0.05) 76%, transparent 77%, transparent ), linear-gradient( 90deg, transparent 24%, rgba(250, 250, 250, 0.05) 25%, rgba(250, 250, 250, 0.05) 26%, transparent 27%, transparent 74%, rgba(250, 250, 250, 0.05) 75%, rgba(250, 250, 250, 0.05) 76%, transparent 77%, transparent ); }
render () { return <div className='app-wrapper'> <div className='canvas-wrapper'> <CanvasWidget engine={engine} /> </div> </div> }
It works like a charm! you saved my day. thx :D
I just close this issue due to inactivity (don't know if resolved).
I have sample code from docs.
I have to drag and move node very slowly. Cursor leaves node at some place behind while I'm still dragging (holding mousebutton down). Node is selected and still in dragging event so when I return back to the node the drag animation comes up again.
Using newest version of browser (firefox, chrome). React-diagrams v 6.1.1.
Edit: dependencies: