optimization preserveDrawingBuffer: false

This commit is contained in:
Matthieu Baumann
2026-05-28 20:10:37 +02:00
parent 3d10dce89e
commit 58ffb782cc
7 changed files with 5410 additions and 5406 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ name = "aladin-lite"
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
license = "BSD-3-Clause"
repository = "https://github.com/cds-astro/aladin-lite"
version = "3.8.2"
version = "3.9.0"
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "al-api"
version = "3.8.2"
version = "3.9.0"
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "al-core"
version = "3.8.2"
version = "3.9.0"
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
edition = "2018"
+4 -5
View File
@@ -29,16 +29,15 @@ impl WebGlContext {
.dyn_into::<web_sys::HtmlCanvasElement>()
.unwrap_abort();
// See https://stackoverflow.com/a/26790802/13456997
// preserveDrawingBuffer enabled for exporting the view as a PNG
let context_options =
js_sys::JSON::parse("{\"antialias\":false, \"preserveDrawingBuffer\": true}")?;
//let context_options = js_sys::JSON::parse("{}")?;
//let context_options =
// js_sys::JSON::parse("{\"antialias\":false}")?;
//js_sys::JSON::parse("{\"antialias\":false}")?;
#[cfg(feature = "webgl2")]
let gl = Rc::new(
canvas
.get_context_with_context_options("webgl2", context_options.as_ref())?
.get_context("webgl2")?
.unwrap_abort()
.dyn_into::<WebGlRenderingCtx>()
.unwrap_abort(),
+5398 -5397
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2211,7 +2211,7 @@ export let Aladin = (function () {
* view in the counter clockwise order (or towards the east)
*/
Aladin.prototype.setRotation = function (rotation) {
if (Utils.isNumber(rotation)) {
if (!Utils.isNumber(rotation)) {
console.warn("Rotation angle is not valid:", rotation)
return;
}
+4
View File
@@ -581,6 +581,10 @@ export let View = (function () {
};
View.prototype.getRawPixelsCanvas = function(width, height) {
// important: redraw must be called just before getting the pixels
// because the drawing buffer is not preserved (preserveDrawingBuffer = false)
this.redraw()
const canvas = this.wasm.canvas();
const c = document.createElement('canvas');