This commit is contained in:
@@ -35,8 +35,10 @@ class GenericObject extends EventManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.description){
|
if (data.description){
|
||||||
engine.dashboard.updateText(this.object.__onhud ? data.description : '', false, (d)=>{
|
engine.dashboard.updateText(this.object.__onhud ? data.description : '', {
|
||||||
|
textScrolledCallback: (d)=>{
|
||||||
d && this.dispatchEvent({type:'finish'})
|
d && this.dispatchEvent({type:'finish'})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
import { EventManager } from "@/lib/EventManager";
|
||||||
import { MeshStandardMaterial, MeshBasicMaterial, PlaneGeometry, Mesh, DoubleSide, Vector3 } from "three";
|
import { MeshStandardMaterial, MeshBasicMaterial, PlaneGeometry, Mesh, DoubleSide, Vector3 } from "three";
|
||||||
|
|
||||||
class ImageObject {
|
class ImageObject extends EventManager{
|
||||||
constructor(engine, obj) {
|
constructor(engine, obj) {
|
||||||
|
super();
|
||||||
return new Promise(async(resolve, reject)=>{
|
return new Promise(async(resolve, reject)=>{
|
||||||
if (obj.$go){
|
if (obj.$go){
|
||||||
obj.path = engine.assetPath;
|
obj.path = engine.assetPath;
|
||||||
@@ -32,6 +34,12 @@ class ImageObject {
|
|||||||
}
|
}
|
||||||
this.object = new Mesh(geo, mp.metalness ? new MeshStandardMaterial(mp) : new MeshBasicMaterial(mp));
|
this.object = new Mesh(geo, mp.metalness ? new MeshStandardMaterial(mp) : new MeshBasicMaterial(mp));
|
||||||
|
|
||||||
|
if (obj.description) {
|
||||||
|
engine.clickable.add(this.object, ()=>{
|
||||||
|
engine.dashboard.updateText(obj.description, {hideOnFinish: true})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
resolve(this)
|
resolve(this)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div v-if="modelValue.go">
|
<div v-if="modelValue.go">
|
||||||
<v-img :src="`/asset/thumb/${modelValue.go}.webp`" />
|
<v-img :src="`/asset/thumb/${modelValue.go}.webp`" />
|
||||||
<div class="text-caption text-center">{{ modelValue.title }}</div>
|
<div class="text-caption text-center">{{ modelValue.title }}</div>
|
||||||
|
<v-textarea :label="l.description" v-model="modelValue.description"></v-textarea>
|
||||||
</div>
|
</div>
|
||||||
<asset-selector @select="assignTexture" :type="['Texture']">
|
<asset-selector @select="assignTexture" :type="['Texture']">
|
||||||
<template v-slot:activator="props">
|
<template v-slot:activator="props">
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class InteractiveObject extends EventManager{
|
|||||||
//process first interaction
|
//process first interaction
|
||||||
this.io.once('interaction', ()=>{
|
this.io.once('interaction', ()=>{
|
||||||
if (obj.introText){
|
if (obj.introText){
|
||||||
engine.dashboard.updateText(obj.introText, true)
|
engine.dashboard.updateText(obj.introText, {hideOnFinish: true});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.io.addEventListener('interaction', ()=>{
|
this.io.addEventListener('interaction', ()=>{
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ class VideoPlayer extends EventManager {
|
|||||||
if (data.immersive || 1){
|
if (data.immersive || 1){
|
||||||
engine.immersive(true);
|
engine.immersive(true);
|
||||||
}
|
}
|
||||||
|
if (data.description) {
|
||||||
|
engine.dashboard.updateText(data.description, {
|
||||||
|
hideOnFinish: true,
|
||||||
|
startFrom: vi.currentTime / vi.duration,
|
||||||
|
duration: vi.duration
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPause = ()=>{
|
const onPause = ()=>{
|
||||||
@@ -57,6 +64,9 @@ class VideoPlayer extends EventManager {
|
|||||||
if (data.immersive || 1){
|
if (data.immersive || 1){
|
||||||
engine.immersive(false);
|
engine.immersive(false);
|
||||||
}
|
}
|
||||||
|
if (data.description) {
|
||||||
|
engine.dashboard.updateText('')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.addEventListener('play', onPlay);
|
vi.addEventListener('play', onPlay);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<v-img :src="`/asset/thumb/${modelValue.go}.webp`" />
|
<v-img :src="`/asset/thumb/${modelValue.go}.webp`" />
|
||||||
<div class="text-caption text-center">{{ modelValue.title }}</div>
|
<div class="text-caption text-center">{{ modelValue.title }}</div>
|
||||||
<v-checkbox density="compact" v-model="modelValue.playInHud" hide-details :label="l.viewInHUD"></v-checkbox>
|
<v-checkbox density="compact" v-model="modelValue.playInHud" hide-details :label="l.viewInHUD"></v-checkbox>
|
||||||
|
<v-textarea :label="l.description" v-model="modelValue.description"></v-textarea>
|
||||||
</div>
|
</div>
|
||||||
<asset-selector @select="assignVideoObject" :type="['Video']">
|
<asset-selector @select="assignVideoObject" :type="['Video']">
|
||||||
<template v-slot:activator="props">
|
<template v-slot:activator="props">
|
||||||
|
|||||||
+33
-15
@@ -121,39 +121,57 @@ class DashBoard extends EventManager {
|
|||||||
sceneHeader.init(scene, startBtnCallback);
|
sceneHeader.init(scene, startBtnCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateText = function(t, hideOnFinish = false, textScrolledCallback){
|
this.updateText = function(t, params = {}){
|
||||||
if (!textPlane) return;
|
if (!textPlane) return;
|
||||||
textPlane.visible = !!t;
|
textPlane.visible = !!t;
|
||||||
engine.motionQueue.clear(text);
|
engine.motionQueue.clear(text);
|
||||||
text.text = t;
|
text.text = t;
|
||||||
text.anchorY = 0.03 * dashHeight;
|
text.anchorY = 0.03 * dashHeight;
|
||||||
text.sync(async()=>{
|
text.sync(async()=>{
|
||||||
|
//console.log(text.clipRect);
|
||||||
let dMax = text.textRenderInfo.blockBounds[3] - text.textRenderInfo.blockBounds[1];
|
let dMax = text.textRenderInfo.blockBounds[3] - text.textRenderInfo.blockBounds[1];
|
||||||
let dh = dMax + text.clipRect[1];
|
let dh = dMax + text.clipRect[1];
|
||||||
|
if (params.startFrom){
|
||||||
|
text.anchorY = text.anchorY + (-dh -text.anchorY) * params.startFrom;
|
||||||
|
}
|
||||||
if (dh > 0){
|
if (dh > 0){
|
||||||
let updateFn = ()=>{
|
// let updateFn = ()=>{
|
||||||
//text.sync();
|
// //text.sync();
|
||||||
if (text.textRenderInfo.blockBounds[1]> text.clipRect[1] * 1.33 ){
|
// //console.log(text.clipRect, text.textRenderInfo.blockBounds)
|
||||||
textScrolledCallback?.(true);
|
// if (text.textRenderInfo.blockBounds[1] > text.clipRect[1] ){
|
||||||
textScrolledCallback = null;
|
// params.textScrolledCallback?.(true);
|
||||||
if (hideOnFinish){
|
// params.textScrolledCallback = null;
|
||||||
|
// if (params.hideOnFinish){
|
||||||
|
// this.updateText('')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
engine.motionQueue.add({
|
||||||
|
o: text,
|
||||||
|
a: { anchorY: -dh },
|
||||||
|
t: params.duration ? (params.duration * (1-params.startFrom||0)) : (dMax*77 / dashHeight),
|
||||||
|
f: ()=>{
|
||||||
|
params.textScrolledCallback?.(true);
|
||||||
|
params.textScrolledCallback = null;
|
||||||
|
if (params.hideOnFinish){
|
||||||
this.updateText('')
|
this.updateText('')
|
||||||
}
|
}else{
|
||||||
}
|
|
||||||
}
|
|
||||||
engine.motionQueue.add({
|
engine.motionQueue.add({
|
||||||
o: text,
|
o: text,
|
||||||
a: { anchorY: -dMax },
|
a: { anchorY: -dMax },
|
||||||
t: dMax*99 / dashHeight,
|
t: 4,
|
||||||
u: updateFn
|
f: params.textFinishCallback
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
if (hideOnFinish){
|
if (params.hideOnFinish){
|
||||||
await Utils.wait(10000);
|
await Utils.wait(10000);
|
||||||
if (text.text == t) this.updateText('')
|
if (text.text == t) this.updateText('')
|
||||||
textScrolledCallback?.(false)
|
params.textScrolledCallback?.(false)
|
||||||
}else{
|
}else{
|
||||||
textScrolledCallback?.(false)
|
params.textScrolledCallback?.(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user