-
-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
117 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import CoreBase from '../Core/Base.js' | ||
import Registry from '../Registry.js' | ||
import { ControlConfigRoom } from '../Controls/ControlBase.js' | ||
import { ParseInternalControlReference } from '../Internal/Util.js' | ||
// import LogController from '../Log/Controller.js' | ||
|
||
/** | ||
* Get Socket.io room for preview updates | ||
|
@@ -28,7 +27,6 @@ function ensureLocationIsNumber(location) { | |
/** | ||
* The class that manages bank preview generation/relay for interfaces | ||
* | ||
* @extends CoreBase | ||
* @author Håkon Nessjøen <[email protected]> | ||
* @author Keith Rocheck <[email protected]> | ||
* @author William Viker <[email protected]> | ||
|
@@ -46,20 +44,44 @@ function ensureLocationIsNumber(location) { | |
* develop commercial activities involving the Companion software without | ||
* disclosing the source code of your own applications. | ||
*/ | ||
class GraphicsPreview extends CoreBase { | ||
class GraphicsPreview { | ||
// #logger = LogController.createLogger('Graphics/Preview') | ||
|
||
/** | ||
* @readonly | ||
* @type {import('./Controller.js').default} | ||
*/ | ||
#graphicsController | ||
|
||
/** | ||
* @readonly | ||
* @type {import('../UI/Handler.js').default} | ||
*/ | ||
#ioController | ||
|
||
/** | ||
* @readonly | ||
* @type {import('../Page/Controller.js').default} | ||
*/ | ||
#pageController | ||
|
||
/** | ||
* Current bank reference previews | ||
* @type {Map<string, PreviewSession>} | ||
*/ | ||
#bankReferencePreviews = new Map() | ||
|
||
/** | ||
* @param {Registry} registry - the application core | ||
* @param {import('./Controller.js').default} graphicsController | ||
* @param {import("../UI/Handler.js").default } ioController | ||
* @param {import("../Page/Controller.js").default} pageController | ||
*/ | ||
constructor(registry) { | ||
super(registry, 'preview', 'Graphics/Preview') | ||
constructor(graphicsController, ioController, pageController) { | ||
this.#graphicsController = graphicsController | ||
this.#ioController = ioController | ||
this.#pageController = pageController | ||
|
||
this.graphics.on('button_drawn', this.#updateButton.bind(this)) | ||
this.#graphicsController.on('button_drawn', this.#updateButton.bind(this)) | ||
} | ||
|
||
/** | ||
|
@@ -94,7 +116,7 @@ class GraphicsPreview extends CoreBase { | |
|
||
client.join(PreviewLocationRoom(location)) | ||
|
||
const render = this.graphics.getBank(location) | ||
const render = this.#graphicsController.getBank(location) | ||
return { image: render.asDataUrl, isUsed: !!render.style } | ||
} | ||
) | ||
|
@@ -149,7 +171,7 @@ class GraphicsPreview extends CoreBase { | |
client, | ||
}) | ||
|
||
return result.location ? this.graphics.getBank(result.location).asDataUrl : null | ||
return result.location ? this.#graphicsController.getBank(result.location).asDataUrl : null | ||
} | ||
) | ||
client.onPromise( | ||
|
@@ -174,17 +196,17 @@ class GraphicsPreview extends CoreBase { | |
*/ | ||
#updateButton(location, render) { | ||
// Push the updated render to any clients viewing a preview of a control | ||
const controlId = this.page.getControlIdAt(location) | ||
const controlId = this.#pageController.getControlIdAt(location) | ||
if (controlId) { | ||
const controlRoom = ControlConfigRoom(controlId) | ||
if (this.io.countRoomMembers(controlRoom) > 0) { | ||
this.io.emitToRoom(controlRoom, `controls:preview-${controlId}`, render.asDataUrl) | ||
if (this.#ioController.countRoomMembers(controlRoom) > 0) { | ||
this.#ioController.emitToRoom(controlRoom, `controls:preview-${controlId}`, render.asDataUrl) | ||
} | ||
} | ||
|
||
const locationRoom = PreviewLocationRoom(location) | ||
if (this.io.countRoomMembers(locationRoom) > 0) { | ||
this.io.emitToRoom(locationRoom, `preview:location:render`, location, render.asDataUrl, !!render.style) | ||
if (this.#ioController.countRoomMembers(locationRoom) > 0) { | ||
this.#ioController.emitToRoom(locationRoom, `preview:location:render`, location, render.asDataUrl, !!render.style) | ||
} | ||
|
||
// Lookup any sessions | ||
|
@@ -238,7 +260,7 @@ class GraphicsPreview extends CoreBase { | |
|
||
previewSession.client.emit( | ||
`preview:button-reference:update:${previewSession.id}`, | ||
this.graphics.getBank(result.location).asDataUrl | ||
this.#graphicsController.getBank(result.location).asDataUrl | ||
) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.