show transparent image when nothing loaded
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { bytesToText, bytesToUrl } from '../converters.js';
|
import { bytesToText, bytesToUrl } from '../converters.js';
|
||||||
import BasePanel from './BasePanel.js';
|
import BasePanel from './BasePanel.js';
|
||||||
import * as AudioReceiver from '../AudioReceiver.js';
|
import * as AudioReceiver from '../AudioReceiver.js';
|
||||||
|
const NO_IMAGE = 'transparent.png';
|
||||||
class ReceivePanel extends BasePanel {
|
class ReceivePanel extends BasePanel {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('Audio Receiver');
|
super('Audio Receiver');
|
||||||
@@ -17,7 +17,7 @@ class ReceivePanel extends BasePanel {
|
|||||||
this.addProgressBar('progress', 0, 0);
|
this.addProgressBar('progress', 0, 0);
|
||||||
|
|
||||||
this.addCode('text', '', 'small');
|
this.addCode('text', '', 'small');
|
||||||
this.addImage('image', undefined, {width: 32, height: 32});
|
this.addImage('image', NO_IMAGE, {width: 32, height: 32});
|
||||||
this.setDataType('text');
|
this.setDataType('text');
|
||||||
|
|
||||||
this.dispatcher.addListener('onlineChange', (e) => {
|
this.dispatcher.addListener('onlineChange', (e) => {
|
||||||
@@ -64,11 +64,14 @@ class ReceivePanel extends BasePanel {
|
|||||||
}
|
}
|
||||||
setReceivedHtml = (html) => this.setHtmlById('text', html);
|
setReceivedHtml = (html) => this.setHtmlById('text', html);
|
||||||
setReceivedBytes = bytes => {
|
setReceivedBytes = bytes => {
|
||||||
console.log('received', bytes);
|
|
||||||
if(this.dataType === 'text') {
|
if(this.dataType === 'text') {
|
||||||
this.setValueById('text', bytesToText(bytes));
|
this.setValueById('text', bytesToText(bytes));
|
||||||
} else {
|
} else {
|
||||||
|
if(bytes !== undefined && bytes.length > 0) {
|
||||||
this.setValueById('image', bytesToUrl(bytes));
|
this.setValueById('image', bytesToUrl(bytes));
|
||||||
|
} else {
|
||||||
|
this.setValueById('image', NO_IMAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
transparent.png
Normal file
BIN
transparent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
Reference in New Issue
Block a user