Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 2
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 926 times and has 1 reply Next Thread
cbcomputer
Newbie



France
Joined: Aug 31, 2018
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
AddLabel WebGL

Bonjour,
j'essaye d'ajouter un label dynamique apres le chargement du plugin WebGl ViewHome mais ca marche pas
pouvez vous m'aider ?
Merci


var retour = viewHome("viewerCanvas", // Id of the canvas
homeUrl, // URL or relative URL of the home to display
onerror, // Callback called in case of error
onprogression, // Callback called while loading
{
roundsPerMinute: 0, // Rotation speed of the animation launched once home is loaded in rounds per minute, no animation if missing or equal to 0
navigationPanel: "none", // Displayed navigation arrows, "none" or "default" for default one or an HTML string containing elements with data-simulated-key
// attribute set "UP", "DOWN", "LEFT", "RIGHT"... to replace the default navigation panel, "none" if missing
aerialViewButtonId: "aerialView", // Id of the aerial view radio button, radio buttons hidden if missing

levelsAndCamerasListId: "levelsAndCameras", // Id of the levels and cameras select component, hidden if missing
/* level: "Roof", */ // Uncomment to select the displayed level, default level if missing */
/* selectableLevels: ["Ground floor", "Roof"], */ // Uncomment to choose the list of displayed levels, no select component if empty array */
/* camera: "Exterior view", */ // Uncomment to select a camera, default camera if missing */
/* selectableCameras: ["Exterior view", "Kitchen"], */ // Uncomment to choose the list of displayed cameras, no camera if missing */
activateCameraSwitchKey: true // Switch between top view / virtual visit with space bar if not false or missing */
});



//r = <label level='level0' x='1222.611' y='218.17773' elevation='250.0' pitch='0.0'>
// <textStyle fontSize='100.0' />
//<text>OTA</text>
//</label>


// var l = this.createLabel(r, "test");
//this.setLabelAttributes(l, "label", r);
// this.home.addLabel(l);



setTimeout(macreationlabel, 5000,retour);


function macreationlabel(retour) {

var mylabel = new Label();
mylabel.x = '1200.00';
mylabel.y = '218.00';
mylabel.pitch = '0.0';
mylabel.elevation = '250.0';
mylabel.text = "toto";
mylabel.level = 'level0';
mylabel.setStyle("fontSize='100.0'");


this.retour.home.addLabel(mylabel);



}


</script>

[Aug 31, 2018, 9:37:31 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: AddLabel WebGL

Bonjour,

Il semblerait que ce soit surtout des problèmes d'utilisation de l'API :
- La classe Label a un constructeur avec 3 paramètres
- Les modifications des valeurs des attributs x, y, pitch... et surtout level devrait s'effectuer avec les méthodes set... de la classe Label
- Si vous utilisez des niveaux dans votre logement, vous pouvez récupérer les objets de classe Level avec la méthode getLevels de la classe Home. Sinon, pas besoin d'appeler setLevel
- La méthode setStyle prend un objet de classe TextStyle

Vous pourriez aussi regarder dans le code source de Sweet Home 3D JS le test testHome.html qui crée un label (entre autres choses).

Sinon quelles erreurs avez-vous dans la console JavaScript?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 1, 2018, 5:55:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved