If filmout picture source is set, set the field guide to match the aspect ratio of the image. Right now that only works if ratio is lower than the screen. Need to add case in display.html that corrects for when screen ratio is lower than image ratio.

This commit is contained in:
sixteenmillimeter 2019-08-25 15:26:43 -04:00
parent 51acbdfd30
commit 9b2ed018bf
17 changed files with 57 additions and 35 deletions

View File

@ -30,7 +30,8 @@
background: #fff; background: #fff;
display: none; display: none;
position: fixed; position: fixed;
left: 0; left: 50%;
transform: translateX(-50%);
top: 0; top: 0;
} }
#can.show{ #can.show{
@ -113,18 +114,27 @@
ctx.translate(- w / 2, -h / 2) ctx.translate(- w / 2, -h / 2)
} }
} }
async function onField () { async function onField (evt, arg) {
console.log('field guide') console.log('field guide')
console.dir(arg)
const can = document.getElementById('can') const can = document.getElementById('can')
const dpr = window.devicePixelRatio || 1 const dpr = window.devicePixelRatio || 1
let ctx; let ctx;
if (!can.classList.contains('show')) { if (!can.classList.contains('show')) {
can.classList.add('show') can.classList.add('show')
} }
can.width = window.innerWidth * dpr if (arg.ratio) {
can.height = window.innerHeight * dpr can.width = (window.innerHeight * arg.ratio) * dpr
} else {
can.width = window.innerWidth * dpr
}
can.height = window.innerHeight * dpr
can.style.width = `${window.innerWidth}px` if (arg.ratio) {
can.style.width = `${window.innerHeight * arg.ratio}px`
} else {
can.style.width = `${window.innerWidth}px`
}
can.style.height = `${window.innerHeight}px` can.style.height = `${window.innerHeight}px`
ctx = can.getContext('2d') ctx = can.getContext('2d')

View File

@ -86,14 +86,14 @@ class WebView {
console.error(err); console.error(err);
} }
} }
async field() { async field(ratio) {
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`); console.warn(`Cannot show field guide because window does not exist`);
return false; return false;
} }
await delay_1.delay(500); await delay_1.delay(500);
try { try {
this.digitalWindow.webContents.send('field', { field: true }); this.digitalWindow.webContents.send('field', { field: true, ratio });
} }
catch (err) { catch (err) {
console.error(err); console.error(err);
@ -189,8 +189,8 @@ class Display {
async focus() { async focus() {
return await this.wv.focus(); return await this.wv.focus();
} }
async field() { async field(ratio) {
return await this.wv.field(); return await this.wv.field(ratio);
} }
async meter() { async meter() {
return await this.wv.meter(); return await this.wv.meter();

File diff suppressed because one or more lines are too long

View File

@ -290,10 +290,11 @@ class FilmOut {
* *
**/ **/
async field(evt, arg) { async field(evt, arg) {
const ratio = arg.ratio;
this.log.info(`Showing field guide screen`); this.log.info(`Showing field guide screen`);
try { try {
await this.display.open(); await this.display.open();
await this.display.field(); await this.display.field(ratio);
} }
catch (err) { catch (err) {
this.log.error(err, 'FILMOUT', true, true); this.log.error(err, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

View File

@ -235,7 +235,11 @@ class FilmOut {
ipcRenderer.send('focus', { focus: true }); ipcRenderer.send('focus', { focus: true });
} }
field() { field() {
ipcRenderer.send('field', { field: true }); let ratio = null;
if (this.state.name) {
ratio = this.state.width / this.state.height;
}
ipcRenderer.send('field', { field: true, ratio });
} }
meter() { meter() {
ipcRenderer.send('meter', { meter: true }); ipcRenderer.send('meter', { meter: true });

View File

@ -172,7 +172,7 @@ class FilmOut {
let obj : any = { let obj : any = {
path : filePath, path : filePath,
fileName fileName
} };
if (filePath && filePath !== '') { if (filePath && filePath !== '') {
proceed = confirm(`Are you sure you want to use ${fileName}?`); proceed = confirm(`Are you sure you want to use ${fileName}?`);
@ -183,7 +183,7 @@ class FilmOut {
if (proceed) { if (proceed) {
gui.overlay(true); gui.overlay(true);
gui.spinner(true, `Getting info about ${fileName}`); gui.spinner(true, `Getting info about ${fileName}`);
ipcRenderer.send('filmout', obj) ipcRenderer.send('filmout', obj);
} else { } else {
$('#projector_type_digital').prop('checked', 'checked'); $('#projector_type_digital').prop('checked', 'checked');
$('#digital').removeClass('active'); $('#digital').removeClass('active');
@ -267,7 +267,11 @@ class FilmOut {
} }
field () { field () {
ipcRenderer.send('field', { field : true }); let ratio : number = null;
if (this.state.name) {
ratio = this.state.width / this.state.height
}
ipcRenderer.send('field', { field : true, ratio });
} }
meter () { meter () {

View File

@ -86,14 +86,14 @@ class WebView {
console.error(err); console.error(err);
} }
} }
async field() { async field(ratio) {
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`); console.warn(`Cannot show field guide because window does not exist`);
return false; return false;
} }
await delay_1.delay(500); await delay_1.delay(500);
try { try {
this.digitalWindow.webContents.send('field', { field: true }); this.digitalWindow.webContents.send('field', { field: true, ratio });
} }
catch (err) { catch (err) {
console.error(err); console.error(err);
@ -189,8 +189,8 @@ class Display {
async focus() { async focus() {
return await this.wv.focus(); return await this.wv.focus();
} }
async field() { async field(ratio) {
return await this.wv.field(); return await this.wv.field(ratio);
} }
async meter() { async meter() {
return await this.wv.meter(); return await this.wv.meter();

File diff suppressed because one or more lines are too long

View File

@ -290,10 +290,11 @@ class FilmOut {
* *
**/ **/
async field(evt, arg) { async field(evt, arg) {
const ratio = arg.ratio;
this.log.info(`Showing field guide screen`); this.log.info(`Showing field guide screen`);
try { try {
await this.display.open(); await this.display.open();
await this.display.field(); await this.display.field(ratio);
} }
catch (err) { catch (err) {
this.log.error(err, 'FILMOUT', true, true); this.log.error(err, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

View File

@ -86,14 +86,14 @@ class WebView {
console.error(err); console.error(err);
} }
} }
async field() { async field(ratio) {
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`); console.warn(`Cannot show field guide because window does not exist`);
return false; return false;
} }
await delay_1.delay(500); await delay_1.delay(500);
try { try {
this.digitalWindow.webContents.send('field', { field: true }); this.digitalWindow.webContents.send('field', { field: true, ratio });
} }
catch (err) { catch (err) {
console.error(err); console.error(err);
@ -189,8 +189,8 @@ class Display {
async focus() { async focus() {
return await this.wv.focus(); return await this.wv.focus();
} }
async field() { async field(ratio) {
return await this.wv.field(); return await this.wv.field(ratio);
} }
async meter() { async meter() {
return await this.wv.meter(); return await this.wv.meter();

File diff suppressed because one or more lines are too long

View File

@ -290,10 +290,11 @@ class FilmOut {
* *
**/ **/
async field(evt, arg) { async field(evt, arg) {
const ratio = arg.ratio;
this.log.info(`Showing field guide screen`); this.log.info(`Showing field guide screen`);
try { try {
await this.display.open(); await this.display.open();
await this.display.field(); await this.display.field(ratio);
} }
catch (err) { catch (err) {
this.log.error(err, 'FILMOUT', true, true); this.log.error(err, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

View File

@ -93,14 +93,14 @@ class WebView {
console.error(err); console.error(err);
} }
} }
async field () { async field (ratio : number) {
if (!this.digitalWindow) { if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`); console.warn(`Cannot show field guide because window does not exist`);
return false; return false;
} }
await delay(500); await delay(500);
try { try {
this.digitalWindow.webContents.send('field', { field : true }); this.digitalWindow.webContents.send('field', { field : true, ratio });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
@ -210,8 +210,8 @@ class Display {
public async focus () { public async focus () {
return await this.wv.focus(); return await this.wv.focus();
} }
public async field () { public async field ( ratio : number) {
return await this.wv.field(); return await this.wv.field(ratio);
} }
public async meter () { public async meter () {
return await this.wv.meter(); return await this.wv.meter();

View File

@ -292,10 +292,11 @@ class FilmOut {
* *
**/ **/
async field (evt : any, arg : any) { async field (evt : any, arg : any) {
const ratio : number = arg.ratio;
this.log.info(`Showing field guide screen`); this.log.info(`Showing field guide screen`);
try { try {
await this.display.open(); await this.display.open();
await this.display.field(); await this.display.field(ratio);
} catch (err) { } catch (err) {
this.log.error(err, 'FILMOUT', true, true); this.log.error(err, 'FILMOUT', true, true);
} }