|
@@ -61,11 +61,17 @@ export const Canvas3DParams = {
|
|
|
}, { pivot: 'radius' }),
|
|
|
viewport: PD.MappedStatic('canvas', {
|
|
|
canvas: PD.Group({}),
|
|
|
- custom: PD.Group({
|
|
|
+ 'static-frame': PD.Group({
|
|
|
x: PD.Numeric(0),
|
|
|
y: PD.Numeric(0),
|
|
|
width: PD.Numeric(128),
|
|
|
height: PD.Numeric(128)
|
|
|
+ }),
|
|
|
+ 'relative-frame': PD.Group({
|
|
|
+ x: PD.Numeric(0.33, { min: 0, max: 1, step: 0.01 }),
|
|
|
+ y: PD.Numeric(0.33, { min: 0, max: 1, step: 0.01 }),
|
|
|
+ width: PD.Numeric(0.5, { min: 0.01, max: 1, step: 0.01 }),
|
|
|
+ height: PD.Numeric(0.5, { min: 0.01, max: 1, step: 0.01 })
|
|
|
})
|
|
|
}),
|
|
|
|
|
@@ -805,12 +811,21 @@ namespace Canvas3D {
|
|
|
y = 0;
|
|
|
width = gl.drawingBufferWidth;
|
|
|
height = gl.drawingBufferHeight;
|
|
|
- } else {
|
|
|
+ } else if (p.viewport.name === 'static-frame') {
|
|
|
x = p.viewport.params.x * webgl.pixelRatio;
|
|
|
- y = p.viewport.params.y * webgl.pixelRatio;
|
|
|
- width = p.viewport.params.width * webgl.pixelRatio;
|
|
|
height = p.viewport.params.height * webgl.pixelRatio;
|
|
|
+ y = gl.drawingBufferHeight - height - p.viewport.params.y * webgl.pixelRatio;
|
|
|
+ width = p.viewport.params.width * webgl.pixelRatio;
|
|
|
+ } else if (p.viewport.name === 'relative-frame') {
|
|
|
+ x = Math.round(p.viewport.params.x * gl.drawingBufferWidth);
|
|
|
+ height = Math.round(p.viewport.params.height * gl.drawingBufferHeight);
|
|
|
+ y = Math.round(gl.drawingBufferHeight - height - p.viewport.params.y * gl.drawingBufferHeight);
|
|
|
+ width = Math.round(p.viewport.params.width * gl.drawingBufferWidth);
|
|
|
+ // if (x + width >= gl.drawingBufferWidth) width = gl.drawingBufferWidth - x;
|
|
|
+ // if (y + height >= gl.drawingBufferHeight) height = gl.drawingBufferHeight - y - 1;
|
|
|
+ // console.log({ x, y, width, height });
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function syncViewport() {
|