Closed robbiejackson closed 4 years ago
Ok, I found the answer.
The svg element which defines the drawing area is positioned using absolute positioning.
Hence what you need to do is to set position:relative on the container element. This changes things so that any children of the container element which use absolute positioning are positioned relative to the container, rather than relative to the HTML body. This is described well in https://css-tricks.com/absolute-positioning-inside-relative-positioning/.
I am trying to write an application which has a layout similar to the draw2d example "buildin_commandstack", with a panel (a column) from which you can drag in items into the drawing area.
I can see that your example uses jQuery UI Layout, but I'm reluctant to use this library as it seems not to have been updated since 2012 at least. So I'm try to use split.js to implement the resizeable panels.
The problem I'm facing is that the drawing area isn't aligning with the bounds of the container element. I've tried using various ways of aligning columns, but not been successful. An example is below:
When I view this in my browser devtools it shows the
gfx_holder
html element positioned as I expect, but below that element in the document tree there is an svg element (which I presume is the drawing area) which starts at 0,0 and hence the pink circle is drawn outside the container.A similar thing happens when I put the
gfx_holder
container within atd
element positioned on the right hand side within an html table.How do I get the drawing area to align with the html element?
Any help to resolve this would be appreciated thanks!