History

add support for text properties to new html propety tools

ZappoMan committed 12 years ago

Commit 0cb95fc1 parent 3f187411 file · +72 −1Browse files

Unified · Split

examples/html/entityProperties.html+72−1
@@ -135,6 +135,16 @@ · 134 unmodified lines
135135 var elModelAnimationPlaying = document.getElementById("property-model-animation-playing");
136136 var elModelAnimationFPS = document.getElementById("property-model-animation-fps");
137137
138+ var elTextSection = document.getElementById("text-section");
139+ var elTextText = document.getElementById("property-text-text");
140+ var elTextLineHeight = document.getElementById("property-text-line-height");
141+ var elTextTextColorRed = document.getElementById("property-text-text-color-red");
142+ var elTextTextColorGreen = document.getElementById("property-text-text-color-green");
143+ var elTextTextColorBlue = document.getElementById("property-text-text-color-blue");
144+ var elTextBackgroundColorRed = document.getElementById("property-text-background-color-red");
145+ var elTextBackgroundColorGreen = document.getElementById("property-text-background-color-green");
146+ var elTextBackgroundColorBlue = document.getElementById("property-text-background-color-blue");
147+
138148 if (window.EventBridge !== undefined) {
139149 EventBridge.scriptEventReceived.connect(function(data) {
140150 data = JSON.parse(data);
@@ -201,13 +211,27 @@ · 60 unmodified lines
201211 elModelSection.style.display = 'none';
202212 } else {
203213 elModelSection.style.display = 'block';
204−
205214 elModelURL.value = properties.modelURL;
206215 elModelAnimationURL.value = properties.animationURL;
207216 elModelAnimationPlaying.checked = properties.animationPlaying;
208217 elModelAnimationFPS.value = properties.animationFPS;
209218 }
210219
220+ if (properties.type != "Text") {
221+ elTextSection.style.display = 'none';
222+ } else {
223+ elTextSection.style.display = 'block';
224+
225+ elTextText.value = properties.text;
226+ elTextLineHeight.value = properties.lineHeight;
227+ elTextTextColorRed.value = properties.textColor.red;
228+ elTextTextColorGreen.value = properties.textColor.green;
229+ elTextTextColorBlue.value = properties.textColor.blue;
230+ elTextBackgroundColorRed.value = properties.backgroundColor.red;
231+ elTextBackgroundColorGreen.value = properties.backgroundColor.green;
232+ elTextBackgroundColorBlue.value = properties.backgroundColor.blue;
233+ }
234+
211235 if (properties.type != "Light") {
212236 elLightSection.style.display = 'none';
213237 } else {
@@ -320,6 +344,22 @@ · 106 unmodified lines
320344 elModelAnimationPlaying.addEventListener('change', createEmitCheckedPropertyUpdateFunction('animationIsPlaying'));
321345 elModelAnimationFPS.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFPS'));
322346 elModelAnimationFrame.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFrameIndex'));
347+
348+ elTextText.addEventListener('change', createEmitTextPropertyUpdateFunction('text'));
349+ elTextLineHeight.addEventListener('change', createEmitNumberPropertyUpdateFunction('lineHeight'));
350+
351+ var textTextColorChangeFunction = createEmitColorPropertyUpdateFunction(
352+ 'textColor', elTextTextColorRed, elTextTextColorGreen, elTextTextColorBlue);
353+ elTextTextColorRed.addEventListener('change', textTextColorChangeFunction);
354+ elTextTextColorGreen.addEventListener('change', textTextColorChangeFunction);
355+ elTextTextColorBlue.addEventListener('change', textTextColorChangeFunction);
356+
357+ var textBackgroundColorChangeFunction = createEmitColorPropertyUpdateFunction(
358+ 'backgroundColor', elTextBackgroundColorRed, elTextBackgroundColorGreen, elTextBackgroundColorBlue);
359+ elTextBackgroundColorRed.addEventListener('change', textBackgroundColorChangeFunction);
360+ elTextBackgroundColorGreen.addEventListener('change', textBackgroundColorChangeFunction);
361+ elTextBackgroundColorBlue.addEventListener('change', textBackgroundColorChangeFunction);
362+
323363 }
324364 </script>
325365 </head>
@@ -492,6 +532,37 @@ · 166 unmodified lines
492532 </div>
493533 </div>
494534
535+ <div id="text-section" class="multi-property-section">
536+ <div class="property-section">
537+ <label>Text</label>
538+ <span>
539+ <input type="text" id="property-text-text"></input>
540+ </span>
541+ </div>
542+ <div class="property-section">
543+ <label>Line Height</label>
544+ <span>
545+ <input class="coord" type='number' id="property-text-line-height"></input>
546+ </span>
547+ </div>
548+ <div class="property-section">
549+ <label>Text Color</label>
550+ <span>
551+ Red <input class="coord" type='number' id="property-text-text-color-red"></input>
552+ Green <input class="coord" type='number' id="property-text-text-color-green"></input>
553+ Blue <input class="coord" type='number' id="property-text-text-color-blue"></input>
554+ </span>
555+ </div>
556+ <div class="property-section">
557+ <label>Background Color</label>
558+ <span>
559+ Red <input class="coord" type='number' id="property-text-background-color-red"></input>
560+ Green <input class="coord" type='number' id="property-text-background-color-green"></input>
561+ Blue <input class="coord" type='number' id="property-text-background-color-blue"></input>
562+ </span>
563+ </div>
564+ </div>
565+
495566
496567 <div id="light-section" class="multi-property-section">
497568 <div class="property-section">