@shapediver/viewer.rendering-engine.canvas-engine
Advanced tools
Comparing version 1.12.3 to 1.12.4
@@ -5,2 +5,3 @@ "use strict"; | ||
class Canvas { | ||
// #region Constructors (1) | ||
constructor(_id, _originalDefinition, _canvasElement) { | ||
@@ -20,2 +21,4 @@ this._id = _id; | ||
} | ||
// #endregion Constructors (1) | ||
// #region Public Accessors (2) | ||
get canvasElement() { | ||
@@ -27,2 +30,3 @@ return this._canvasElement; | ||
} | ||
// #endregion Public Accessors (2) | ||
reset() { | ||
@@ -29,0 +33,0 @@ var _a; |
@@ -7,2 +7,14 @@ import { UuidGenerator } from '@shapediver/viewer.shared.services'; | ||
protected readonly _uuidGenerator: UuidGenerator; | ||
/** | ||
* Creates a canvas object that could in the future be expanded to hold more information | ||
* The definition of the canvas can be: | ||
* - empty: A canvas is created with an unique ID. | ||
* - string: | ||
* - If a canvas with this ID was created, this canvas is returned. | ||
* - If there is an HTMLCanvasElement in the document with this ID, this is used. | ||
* - If there is no HTMLElement found in the document with this ID, a canvas with ID will be created. | ||
* - HTMLCanvasElement: A Canvas Object will be created with this element. If there is no ID, one will be generated. | ||
* | ||
* @param canvasDefinition the definition of this canvas | ||
*/ | ||
createCanvasObject(canvasDefinition?: string | HTMLCanvasElement, storageId?: string): string; | ||
@@ -9,0 +21,0 @@ getCanvas(storageId: string): ICanvas; |
@@ -15,8 +15,25 @@ "use strict"; | ||
constructor() { | ||
// #region Properties (4) | ||
this._canvasDictionary = {}; | ||
this._uuidGenerator = tsyringe_1.container.resolve(viewer_shared_services_1.UuidGenerator); | ||
// #endregion Public Methods (2) | ||
} | ||
// #endregion Properties (4) | ||
// #region Public Methods (2) | ||
/** | ||
* Creates a canvas object that could in the future be expanded to hold more information | ||
* The definition of the canvas can be: | ||
* - empty: A canvas is created with an unique ID. | ||
* - string: | ||
* - If a canvas with this ID was created, this canvas is returned. | ||
* - If there is an HTMLCanvasElement in the document with this ID, this is used. | ||
* - If there is no HTMLElement found in the document with this ID, a canvas with ID will be created. | ||
* - HTMLCanvasElement: A Canvas Object will be created with this element. If there is no ID, one will be generated. | ||
* | ||
* @param canvasDefinition the definition of this canvas | ||
*/ | ||
createCanvasObject(canvasDefinition, storageId) { | ||
storageId = storageId !== undefined && this._uuidGenerator.validate(storageId) ? storageId : this._uuidGenerator.create(); | ||
if (canvasDefinition instanceof HTMLCanvasElement) { | ||
// a canvas was provided | ||
const canvasElement = canvasDefinition; | ||
@@ -35,2 +52,3 @@ if (!canvasElement.id) | ||
if (canvasElement instanceof HTMLCanvasElement) { | ||
// id of a canvas was provided | ||
this._canvasDictionary[storageId] = new Canvas_1.Canvas(id, canvasDefinition, canvasElement); | ||
@@ -40,2 +58,3 @@ return storageId; | ||
else if (!canvasElement) { | ||
// no HTMLElement could be found, create Canvas with the id | ||
this._canvasDictionary[storageId] = new Canvas_1.Canvas(id, canvasDefinition); | ||
@@ -42,0 +61,0 @@ return storageId; |
{ | ||
"name": "@shapediver/viewer.rendering-engine.canvas-engine", | ||
"version": "1.12.3", | ||
"version": "1.12.4", | ||
"description": "", | ||
@@ -39,7 +39,7 @@ "keywords": [], | ||
"dependencies": { | ||
"@shapediver/viewer.shared.services": "1.12.3", | ||
"@shapediver/viewer.shared.services": "1.12.4", | ||
"gl-matrix": "3.3.0", | ||
"tsyringe": "^4.5.0" | ||
}, | ||
"gitHead": "d30a08bc7f5cef8205ddb7fc1c303178389672a0" | ||
"gitHead": "8eaec07cb71ad7cda7a2b0c09d3a32c2b00bd205" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19435
166
+ Added@shapediver/viewer.shared.build-data@1.12.4(transitive)
+ Added@shapediver/viewer.shared.services@1.12.4(transitive)
- Removed@shapediver/viewer.shared.build-data@1.12.3(transitive)
- Removed@shapediver/viewer.shared.services@1.12.3(transitive)