dependencies hashes:
openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501
ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3
ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239
ofxVariableLab 8df98846248a93aa068989a3ebd0d2f0f16e5e69
ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8
theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18
This commit is contained in:
themancalledjakob 2024-03-22 16:32:09 +01:00
parent f2ed11c206
commit a9a40a8de1
3 changed files with 1 additions and 48 deletions

View file

@ -670,7 +670,6 @@ const Audio = function(tp, record) {
} }
}; };
const addAudio = (layer, propTitle) => { const addAudio = (layer, propTitle) => {
console.log('adding audio for', layer, propTitle);
if (!started) { if (!started) {
init(); init();
} }

View file

@ -101,7 +101,6 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
let axes = fontsAndAxes[selectedFontIndex].axes; let axes = fontsAndAxes[selectedFontIndex].axes;
if (axes.length > 0) { if (axes.length > 0) {
let variationAxes = {}; let variationAxes = {};
//let doThese = [];
for (let a = 0; a < axes.length; a++) { for (let a = 0; a < axes.length; a++) {
const sanity_minMax = axes[a].minValue < axes[a].maxValue; const sanity_minMax = axes[a].minValue < axes[a].maxValue;
const sanity_minDefault = axes[a].minValue <= axes[a].defaultValue; const sanity_minDefault = axes[a].minValue <= axes[a].defaultValue;
@ -110,31 +109,11 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
variationAxes[axes[a].name] = tp.core.types.number(axes[a].defaultValue, { variationAxes[axes[a].name] = tp.core.types.number(axes[a].defaultValue, {
range: [axes[a].minValue, axes[a].maxValue], range: [axes[a].minValue, axes[a].maxValue],
}); });
//if (typeof audio === 'object' &&
//typeof audio.getSavedMapping() === 'object' &&
//typeof audio.getSavedMapping()[this.id()] === 'object' &&
//typeof audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`] === 'object' &&
//typeof audio.getMapping() === 'object' &&
//typeof audio.getMapping()[this.id()] === 'object' &&
//typeof audio.getMapping()[this.id()][`fontVariationAxes.${axes[a].name}`] === 'object' &&
//tp.getPanel() !== null) {
////doThese.push(() => {
////audio.removeAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
////audio.removeAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
////audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].min_out = axes[a].minValue;
////audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].max_out = axes[a].maxValue;
////audio.addAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
////audio.addAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
////});
//}
} else { } else {
console.log('js::layer::selectFont', 'this axis is insane, abort', axes[a]); console.log('js::layer::selectFont', 'this axis is insane, abort', axes[a]);
} }
} }
props.fontVariationAxes = tp.core.types.compound(variationAxes); props.fontVariationAxes = tp.core.types.compound(variationAxes);
//doThese.forEach((d) => {
//d();
//});
} else { } else {
delete props.fontVariationAxes; delete props.fontVariationAxes;
} }
@ -149,26 +128,21 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
return new Promise((resolve) => { return new Promise((resolve) => {
// NOTE: stupid hack, seems that theatrejs tries to be too smart // NOTE: stupid hack, seems that theatrejs tries to be too smart
// detecting if reconfiguring the object is necessary. // detecting if reconfiguring the object is necessary.
// file bug report and test in future versions. // file bug report and test in future versions?
// //
// this overcomplicates some of our code though.. urgh.. // this overcomplicates some of our code though.. urgh..
// btw, we need a dummy property // btw, we need a dummy property
// this does not work // this does not work
//tp.changeObject(this.id(), {}); //tp.changeObject(this.id(), {});
//tp.changeObject(this.id(), {dummy:true});
//updateTheatrePropsTimeout = setTimeout(() => {
tp.changeObject(this.id(), {dummy: true}); tp.changeObject(this.id(), {dummy: true});
setTimeout(() => { setTimeout(() => {
tp.changeObject(this.id(), props); tp.changeObject(this.id(), props);
setTimeout(() => { setTimeout(() => {
//updateTheatrePropsTimeout = false;
//this.afterUpdateTheatrePropsCallback();
this.findInjectPanel(); this.findInjectPanel();
resolve(); resolve();
}, 100); }, 100);
}, 100); }, 100);
//}, 100);
}); });
}; };
const getDefaultFont = (selectableFonts) => { const getDefaultFont = (selectableFonts) => {
@ -299,28 +273,19 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
const showBoundingBoxDiv = (boundingBox = false) => { const showBoundingBoxDiv = (boundingBox = false) => {
const boundingBoxDivId = `boundingBox-${this.id()}`; const boundingBoxDivId = `boundingBox-${this.id()}`;
//const layerBoxDivId = `layerBox-${this.id()}`;
if (document.querySelector(`#${boundingBoxDivId}`) === null) { if (document.querySelector(`#${boundingBoxDivId}`) === null) {
if (boundingBox === false) { if (boundingBox === false) {
boundingBox = Module.getBoundingBox(this.id()); boundingBox = Module.getBoundingBox(this.id());
} }
const artboard = window.getArtboard(); const artboard = window.getArtboard();
const boundingBoxDiv = document.createElement('div'); const boundingBoxDiv = document.createElement('div');
//const layerBoxDiv = document.createElement('div');
boundingBoxDiv.id = boundingBoxDivId; boundingBoxDiv.id = boundingBoxDivId;
boundingBoxDiv.style.position = 'fixed'; boundingBoxDiv.style.position = 'fixed';
boundingBoxDiv.style.background = 'transparent'; boundingBoxDiv.style.background = 'transparent';
boundingBoxDiv.style.border = '1px dashed dimgrey'; boundingBoxDiv.style.border = '1px dashed dimgrey';
boundingBoxDiv.style.boxSizing = 'border-box'; boundingBoxDiv.style.boxSizing = 'border-box';
//layerBoxDiv.id = layerBoxDivId;
//layerBoxDiv.style.position = 'fixed';
//layerBoxDiv.style.background = 'transparent';
//layerBoxDiv.style.border = '1px solid green';
//layerBoxDiv.style.boxSizing = 'border-box';
document.getElementById('body').append(boundingBoxDiv); document.getElementById('body').append(boundingBoxDiv);
//document.getElementById('body').append(layerBoxDiv);
clearInterval(boundingBoxInterval); clearInterval(boundingBoxInterval);
boundingBoxInterval = setInterval(() => { boundingBoxInterval = setInterval(() => {
updateBoundingBoxDiv(); updateBoundingBoxDiv();
@ -335,7 +300,6 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
if (bb !== null) { if (bb !== null) {
bb.remove(); bb.remove();
} }
//document.getElementById(`layerBox-${this.id()}`).remove();
clearInterval(boundingBoxInterval); clearInterval(boundingBoxInterval);
boundingBoxInterval = false; boundingBoxInterval = false;
}; };
@ -449,7 +413,6 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
mom.append(upButton); mom.append(upButton);
mom.append(downButton); mom.append(downButton);
mom.append(removeButton); mom.append(removeButton);
//window.layerOrder.add(this.id());
panel.addEventListener('mouseover', showBoundingBoxDiv); panel.addEventListener('mouseover', showBoundingBoxDiv);
panel.addEventListener('mouseout', hideBoundingBoxDiv); panel.addEventListener('mouseout', hideBoundingBoxDiv);
@ -715,8 +678,6 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
const alignButtonsHorizontal = panel.querySelector('.alignButtonsHorizontal'); const alignButtonsHorizontal = panel.querySelector('.alignButtonsHorizontal');
const alignButtonsVertical = panel.querySelector('.alignButtonsVertical'); const alignButtonsVertical = panel.querySelector('.alignButtonsVertical');
//panelControlsWrapper.add(alignButtonsHorizontal);
//panelControlsWrapper.add(alignButtonsVertical);
// first get previous textAlign buttons, // first get previous textAlign buttons,
// if they are already there // if they are already there

View file

@ -115,14 +115,12 @@ function uploadFile(expectedType = 'application/json') {
if (files.length == 0) return; if (files.length == 0) return;
const file = files[0]; const file = files[0];
console.log('file', file);
let reader = new FileReader(); let reader = new FileReader();
if (expectedType === 'application/zip' || file.type === 'application/zip' || file.type.indexOf('audio') === 0) { if (expectedType === 'application/zip' || file.type === 'application/zip' || file.type.indexOf('audio') === 0) {
reader.onload = (e) => { reader.onload = (e) => {
const f = e.target.result; const f = e.target.result;
console.log(e, file.name, file.size, file.type, f);
resolve({ resolve({
name: file.name, name: file.name,
size: file.size, size: file.size,
@ -136,7 +134,6 @@ function uploadFile(expectedType = 'application/json') {
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
} else if (expectedType === 'application/json') { } else if (expectedType === 'application/json') {
reader.onload = (e) => { reader.onload = (e) => {
console.log(e);
const f = e.target.result; const f = e.target.result;
// This is a regular expression to identify carriage // This is a regular expression to identify carriage
@ -156,12 +153,9 @@ function uploadFile(expectedType = 'application/json') {
reader.readAsText(file); reader.readAsText(file);
} else if (expectedType.indexOf('font') >= 0) { } else if (expectedType.indexOf('font') >= 0) {
console.log('expect font');
reader.onload = (e) => { reader.onload = (e) => {
console.log(e);
const f = e.target.result; const f = e.target.result;
if (file.type.indexOf('font') >= 0) { if (file.type.indexOf('font') >= 0) {
console.log('is font');
//var uint8View = new Uint8Array(f); //var uint8View = new Uint8Array(f);
//console.log('trying to save the font file, file, uint8View', file, uint8View); //console.log('trying to save the font file, file, uint8View', file, uint8View);
//FS.createDataFile(config.fs.idbfsFontDir, file.name, uint8View, true, true); //FS.createDataFile(config.fs.idbfsFontDir, file.name, uint8View, true, true);
@ -182,7 +176,6 @@ function uploadFile(expectedType = 'application/json') {
type: file.type, type: file.type,
arrayBuffer: f arrayBuffer: f
}; };
console.log({outputFile});
resolve(outputFile); resolve(outputFile);
} else { } else {
reject('not a font'); reject('not a font');