Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc 42 merge #286

Merged
merged 21 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
199c08f
Reorder Story view includes to support Explorer as well in the same DOM
gjcope Jun 5, 2024
d327739
Fix for #276. Handle when rounded number inputs match existing values…
gjcope Jun 5, 2024
8cb35a2
use DEFAULT_LANGUAGE everywhere
sdumetz Jun 6, 2024
b7bac8f
show full-text for CVLanguageManager.ins.language in property views
sdumetz Jun 7, 2024
49cf2a4
remove TaskProvider's local language setting
sdumetz Jun 7, 2024
8acf76b
remove TourTask's local language setting
sdumetz Jun 7, 2024
69b59c8
remove AudioTask's local language setting
sdumetz Jun 7, 2024
6e606eb
remove AnnotationTask's local language setting
sdumetz Jun 7, 2024
0804d8c
remove ArticleTask's local language setting
sdumetz Jun 7, 2024
a0dd844
remove CVLanguageManager.ins.language.value in favor of codeString an…
sdumetz Jun 7, 2024
6a9efba
Fix for #279 null reference issue with React
gjcope Jun 11, 2024
c368f07
fix styles for button property options. handle properties with multip…
sdumetz Jun 7, 2024
706c750
fix structure of CollectionPanel that wasn't visually connecting with…
sdumetz Jun 7, 2024
d1e5dbe
properly set language on annotations initialization
sdumetz Jun 11, 2024
d051c56
fix a race condition in CVLanguageManager where a language set by the…
sdumetz Jun 7, 2024
3cbbeb5
use the live directive for sv-property-options select
sdumetz Jun 25, 2024
1c5db8d
Style margin update
gjcope Jun 26, 2024
ec3309b
Intro panel cleanup and bugfix
gjcope Jun 26, 2024
98efd4c
Merge branch 'dev-bugfix' into rc-42
gjcope Jun 26, 2024
ca1e8ea
Version update
gjcope Jun 26, 2024
49ed80c
AudioManager bug fix to correctly init files for all languages on load
gjcope Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voyager",
"version": "0.41.0",
"version": "0.42.0",
"description": "Smithsonian DPO Voyager - 3D Explorer and Tool Suite",
"scripts": {
"start": "npm run server",
Expand Down
7 changes: 6 additions & 1 deletion source/client/components/CVAnnotationView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ export default class CVAnnotationView extends CObject3D

fromData(data: IAnnotation[])
{
data.forEach(annotationJson => this.addAnnotation(new Annotation(annotationJson)));
const language = this.language.outs.language.value;
data.forEach(annotationJson => {
let a = new Annotation(annotationJson);
a.language = language;
this.addAnnotation(a);
});
this.emit<ITagUpdateEvent>({ type: "tag-update" });
}

Expand Down
28 changes: 0 additions & 28 deletions source/client/components/CVAnnotationsTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,12 @@ export default class CVAnnotationsTask extends CVTask

protected static readonly ins = {
mode: types.Enum("Mode", EAnnotationsTaskMode, EAnnotationsTaskMode.Off),
language: types.Option("Task.Language", Object.keys(ELanguageStringType).map(key => ELanguageStringType[key]), ELanguageStringType[ELanguageType.EN]),
audio: types.Option("Annotation.Audio", ["None"], 0),
selection: types.Event("Annotation.Selection")
};

protected static readonly outs = {
language: types.Enum("Interface.Language", ELanguageType, ELanguageType.EN),
};

ins = this.addInputs<CVTask, typeof CVAnnotationsTask.ins>(CVAnnotationsTask.ins);
outs = this.addOutputs<CVTask, typeof CVAnnotationsTask.outs>(CVAnnotationsTask.outs);

private _activeAnnotations: CVAnnotationView = null;
private _defaultScale = 1;
Expand Down Expand Up @@ -104,7 +99,6 @@ export default class CVAnnotationsTask extends CVTask
{
this.startObserving();
super.activateTask();
this.synchLanguage();
this.synchAudioOptions();

//this.selection.selectedComponents.on(CVAnnotationView, this.onSelectAnnotations, this);
Expand Down Expand Up @@ -133,15 +127,6 @@ export default class CVAnnotationsTask extends CVTask
this.emitUpdateEvent();
}

if(ins.language.changed) {
const newLanguage = ELanguageType[ELanguageType[ins.language.value]];

languageManager.addLanguage(newLanguage); // add in case this is a currently inactive language
languageManager.ins.language.setValue(newLanguage);
outs.language.setValue(newLanguage);
return true;
}

if(ins.audio.changed) {
const audioManager = this.activeDocument.setup.audio;
const id = ins.audio.value > 0 ? audioManager.getAudioList()[ins.audio.value - 1].id : "";
Expand All @@ -158,8 +143,6 @@ export default class CVAnnotationsTask extends CVTask
this.setAudio();
}

this.synchLanguage();

return true;
}

Expand Down Expand Up @@ -380,17 +363,6 @@ export default class CVAnnotationsTask extends CVTask
}
}

// Make sure this task language matches document
protected synchLanguage() {
const {ins} = this;
const languageManager = this.activeDocument.setup.language;

if(ins.language.value !== languageManager.outs.language.value)
{
ins.language.setValue(languageManager.outs.language.value, true);
}
}

// Update audio options
protected synchAudioOptions() {
const audioManager = this.activeDocument.setup.audio;
Expand Down
23 changes: 2 additions & 21 deletions source/client/components/CVArticlesTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class CVArticlesTask extends CVTask
lead: types.String("Article.Lead"),
tags: types.String("Article.Tags"),
uri: types.String("Article.URI"),
language: types.Option("Task.Language", Object.keys(ELanguageStringType).map(key => ELanguageStringType[key]), ELanguageStringType[ELanguageType.EN]),
};

protected static readonly outs = {
Expand Down Expand Up @@ -98,7 +97,6 @@ export default class CVArticlesTask extends CVTask
{
this.startObserving();
super.activateTask();
this.synchLanguage();
}

deactivateTask()
Expand All @@ -122,13 +120,6 @@ export default class CVArticlesTask extends CVTask
}
const languageManager = this.activeDocument.setup.language;

if(ins.language.changed) {
const newLanguage = ELanguageType[ELanguageType[ins.language.value]];

languageManager.addLanguage(newLanguage); // add in case this is a currently inactive language
languageManager.ins.language.setValue(newLanguage);
}

if (meta && ins.create.changed) {
const article = new Article();
const defaultFolder = CVMediaManager.articleFolder;
Expand Down Expand Up @@ -309,6 +300,7 @@ export default class CVArticlesTask extends CVTask
const ins = this.ins;
const outs = this.outs;
const meta = this.meta;
const languageManager = this.activeDocument.setup.language;
let article = this.reader.activeArticle;

if (meta && article && meta.articles.getById(article.id)) {
Expand All @@ -320,7 +312,7 @@ export default class CVArticlesTask extends CVTask
// if we don't have a uri for this language, create one so that it is editable
if(article.uri === undefined) {
const defaultFolder = CVMediaManager.articleFolder;
article.uri = `${defaultFolder}/new-article-${article.id}-${ELanguageType[ins.language.value]}.html`;
article.uri = `${defaultFolder}/new-article-${article.id}-${languageManager.codeString()}.html`;
this.ins.version.set();
}
else {
Expand All @@ -344,20 +336,9 @@ export default class CVArticlesTask extends CVTask
const article = this.activeArticle;
const {ins} = this;

this.synchLanguage();
this.onArticleChange();
}

// Make sure this task language matches document
protected synchLanguage() {
const {ins} = this;
const languageManager = this.activeDocument.setup.language;

if(ins.language.value !== languageManager.outs.language.value)
{
ins.language.setValue(languageManager.outs.language.value, true);
}
}

// Handle potential media manager name change
protected onAssetRename(event: IAssetRenameEvent) {
Expand Down
46 changes: 24 additions & 22 deletions source/client/components/CVAudioManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,29 +166,31 @@ export default class CVAudioManager extends Component
}
else {
const clip = this.audioClips[id];
const uri = clip.uris[language];
if(uri) {
const absUri = this.assetManager.getAssetUrl(uri);
clip.durations[language] = "pending";

const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const request = new XMLHttpRequest();
request.open('GET', absUri, true);
request.responseType = 'arraybuffer';
request.onload = () => {
const blob = new Blob([request.response], { type: "audio/mpeg" });
const url = window.URL.createObjectURL(blob);
this._audioMap[uri] = url;
audioContext.decodeAudioData(request.response,
(buffer) => {
let duration = buffer.duration;
clip.durations[language] = duration.toString();
this.getPlayerById(id).requestUpdate();
}
)
Object.keys(clip.uris).forEach(language => {
const uri = clip.uris[language];
if(uri) {
const absUri = this.assetManager.getAssetUrl(uri);
clip.durations[language] = "pending";

const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const request = new XMLHttpRequest();
request.open('GET', absUri, true);
request.responseType = 'arraybuffer';
request.onload = () => {
const blob = new Blob([request.response], { type: "audio/mpeg" });
const url = window.URL.createObjectURL(blob);
this._audioMap[uri] = url;
audioContext.decodeAudioData(request.response,
(buffer) => {
let duration = buffer.duration;
clip.durations[language] = duration.toString();
this.getPlayerById(id).requestUpdate();
}
)
}
request.send();
}
request.send();
}
});

return "pending";
}
Expand Down
35 changes: 8 additions & 27 deletions source/client/components/CVAudioTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import AudioTaskView from "../ui/story/AudioTaskView";
import { Node } from "@ff/graph/Component";
import CVDocument from "./CVDocument";
import CVAudioManager from "./CVAudioManager";
import { ELanguageStringType, ELanguageType } from "client/schema/common";
import { DEFAULT_LANGUAGE, ELanguageStringType, ELanguageType } from "client/schema/common";

////////////////////////////////////////////////////////////////////////////////

Expand All @@ -44,7 +44,6 @@ export default class CVAudioTask extends CVTask
filepath: types.String("Audio.Filepath", null),
captionPath: types.String("Audio.CaptionPath", null),
isNarration: types.Boolean("Audio.IsNarration", false),
language: types.Option("Task.Language", Object.keys(ELanguageStringType).map(key => ELanguageStringType[key]), ELanguageStringType[ELanguageType.EN]),
};

protected static readonly outs = {
Expand Down Expand Up @@ -83,8 +82,6 @@ export default class CVAudioTask extends CVTask
//this.nodeProvider.activeNode = this.nodeProvider.scopedNodes[0];

super.activateTask();

this.synchLanguage();
}

deactivateTask()
Expand All @@ -103,13 +100,7 @@ export default class CVAudioTask extends CVTask

const clip = audioManager.getAudioClip(ins.activeId.value);
const languageManager = this.activeDocument.setup.language;

if(ins.language.changed) {
const newLanguage = ELanguageType[ELanguageType[ins.language.value]];

languageManager.addLanguage(newLanguage); // add in case this is a currently inactive language
languageManager.ins.language.setValue(newLanguage);
}
const activeLanguage = languageManager.codeString();

if (ins.create.changed) {
const newId = Document.generateId();
Expand Down Expand Up @@ -138,8 +129,8 @@ export default class CVAudioTask extends CVTask

if (clip && (ins.title.changed || ins.filepath.changed || ins.captionPath.changed)) {
clip.name = ins.title.value;
clip.uris[ELanguageType[ins.language.value]] = ins.filepath.value;
clip.captionUris[ELanguageType[ins.language.value]] = ins.captionPath.value;
clip.uris[activeLanguage] = ins.filepath.value;
clip.captionUris[activeLanguage] = ins.captionPath.value;
audioManager.updateAudioClip(clip.id);
}
if (ins.isNarration.changed) {
Expand Down Expand Up @@ -172,27 +163,17 @@ export default class CVAudioTask extends CVTask
const ins = this.ins;
const audioManager = this.audioManager;
const clip = audioManager.getAudioClip(ins.activeId.value);
const languageManager = this.activeDocument.setup.language;
const activeLanguage = languageManager.codeString();

ins.title.setValue(clip ? clip.name : "", true);
ins.filepath.setValue(clip ? clip.uris[ELanguageType[ins.language.value]] : "", true);
ins.captionPath.setValue(clip ? clip.captionUris[ELanguageType[ins.language.value]] : "", true);
ins.filepath.setValue(clip ? clip.uris[activeLanguage] : "", true);
ins.captionPath.setValue(clip ? clip.captionUris[activeLanguage] : "", true);
ins.isNarration.setValue(clip ? this.audioManager.narrationId === clip.id : false, true);
}

protected onDocumentLanguageChange()
{
this.synchLanguage();
this.onAudioChange();
}

// Make sure this task language matches document
protected synchLanguage() {
const {ins} = this;
const languageManager = this.activeDocument.setup.language;

if(ins.language.value !== languageManager.outs.language.value)
{
ins.language.setValue(languageManager.outs.language.value, true);
}
}
}
2 changes: 1 addition & 1 deletion source/client/components/CVDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export default class CVDocument extends CRenderGraph

const newTitle = this.titles[ELanguageType[language.outs.language.value]];
this.ins.title.setValue(newTitle);
const newIntro = this.intros[ELanguageType[language.outs.language.value]];
const newIntro = this.intros[ELanguageType[language.outs.language.value]] || "";
this.ins.intro.setValue(newIntro);
}

Expand Down
Loading