mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 16:49:42 +00:00
Merge remote-tracking branch 'origin/open852' into open-master
This commit is contained in:
@ -96,7 +96,15 @@ define(
|
|||||||
* Clear the chart.
|
* Clear the chart.
|
||||||
*/
|
*/
|
||||||
clear: function () {
|
clear: function () {
|
||||||
gl.viewport(0, 0, canvas.width, canvas.height);
|
// Set the viewport size; note that we use the width/height
|
||||||
|
// that our WebGL context reports, which may be lower
|
||||||
|
// resolution than the canvas we requested.
|
||||||
|
gl.viewport(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
gl.drawingBufferWidth,
|
||||||
|
gl.drawingBufferHeight
|
||||||
|
);
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
|
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -107,8 +115,11 @@ define(
|
|||||||
* origin of the chart
|
* origin of the chart
|
||||||
*/
|
*/
|
||||||
setDimensions: function (dimensions, origin) {
|
setDimensions: function (dimensions, origin) {
|
||||||
gl.uniform2fv(uDimensions, dimensions);
|
if (dimensions && dimensions.length > 0 &&
|
||||||
gl.uniform2fv(uOrigin, origin);
|
origin && origin.length > 0) {
|
||||||
|
gl.uniform2fv(uDimensions, dimensions);
|
||||||
|
gl.uniform2fv(uOrigin, origin);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Draw the supplied buffer as a line strip (a sequence
|
* Draw the supplied buffer as a line strip (a sequence
|
||||||
|
@ -106,6 +106,19 @@ define(
|
|||||||
expect(mockGL.drawArrays)
|
expect(mockGL.drawArrays)
|
||||||
.toHaveBeenCalledWith("TRIANGLE_FAN", 0, 4);
|
.toHaveBeenCalledWith("TRIANGLE_FAN", 0, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("uses buffer sizes reported by WebGL", function () {
|
||||||
|
// Make sure that GLChart uses the GL buffer size, which may
|
||||||
|
// differ from what canvas requested. WTD-852
|
||||||
|
mockCanvas.width = 300;
|
||||||
|
mockCanvas.height = 150;
|
||||||
|
mockGL.drawingBufferWidth = 200;
|
||||||
|
mockGL.drawingBufferHeight = 175;
|
||||||
|
|
||||||
|
glChart.clear();
|
||||||
|
|
||||||
|
expect(mockGL.viewport).toHaveBeenCalledWith(0, 0, 200, 175);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Reference in New Issue
Block a user