Parcourir la source

feat(renderer): Add support for retrieving planar imag

pull/1241/head
gitteeee il y a 1 mois
Parent
révision
4d583f7da6
1 fichiers modifiés avec 18 ajouts et 1 suppressions
  1. +18
    -1
      src/js/libpannellum.js

+ 18
- 1
src/js/libpannellum.js Voir le fichier

@@ -50,6 +50,7 @@ function Renderer(container, context) {
var globalParams; var globalParams;
var sides = ['f', 'b', 'u', 'd', 'l', 'r']; var sides = ['f', 'b', 'u', 'd', 'l', 'r'];
var fallbackSides = ['f', 'r', 'b', 'l', 'u', 'd']; var fallbackSides = ['f', 'r', 'b', 'l', 'u', 'd'];
var planarBlob;


if (context) if (context)
gl = context; gl = context;
@@ -986,6 +987,10 @@ function Renderer(container, context) {
multiresDraw(!isPreview); multiresDraw(!isPreview);
} }
canvas.toBlob(function(blob) {
planarBlob = blob;
}, 'image/jpeg');

if (params.returnImage !== undefined) { if (params.returnImage !== undefined) {
if (window.createImageBitmap && params.returnImage == 'ImageBitmap') { if (window.createImageBitmap && params.returnImage == 'ImageBitmap') {
return createImageBitmap(canvas); return createImageBitmap(canvas);
@@ -1042,7 +1047,19 @@ function Renderer(container, context) {
this.getCanvas = function() { this.getCanvas = function() {
return canvas; return canvas;
}; };

/**
* Retrieve renderer's PlanarImg url.
* @memberof Renderer
* @instance
* @returns {HTMLElement} Renderer's PlanarImg url.
*/
this.getPlanarImg = function() {
if(planarBlob){
return URL.createObjectURL(planarBlob);
}
};

/** /**
* Sorting method for multires nodes. * Sorting method for multires nodes.
* @private * @private


Chargement…
Annuler
Enregistrer