Closed softy2k closed 3 years ago
Hello, This seems like a feature request. I will do it a bit later. But for now you can use an easy dirty hack - after the viewer is created, set its camera up vector like this:
this.dxfViewer.camera.up.set(1, 0, 0)
This sets camera up direction to +X. Use -1 to set to -X.
You can insert it after this line of this example: https://github.com/vagran/dxf-viewer-example-src/blob/0b16e6fa5365b4896e0c03e26ed428fa27b4b91c/src/components/DxfViewer.vue#L122
Thanks, problem solved
Now the rotation works, but some DXFs exceed the edges. How could it be solved, to give a kind of auto self fit, after rotation?
Yes, this is the thing which should be taken into account as well when implementing this feature. And again, some monkey-patching can be used as a temporal solution until the feature is implemented in the viewer:
this.dxfViewer.FitView = (minX, maxX, minY, maxY, padding = 0.1) => {
const aspect =
this.dxfViewer.canvasWidth / this.dxfViewer.canvasHeight
let width = maxX - minX
let height = maxY - minY
const center = {x: minX + width / 2, y: minY + height / 2}
/* Swap width and height here. */
const tmp = width
width = height
height = tmp
if (height * aspect > width) {
width = height * aspect
}
if (width <= Number.MIN_VALUE * 2) {
width = 1
}
this.dxfViewer.SetView(center, width * (1 + padding))
}
Hello and thanks for DXF viewer.
I have a question: how to rotate the image generated by DXF viewer? Let's say 90 degrees (left-right)?