소스 검색

Merge pull request #4834 from RaananW/fix-animation-property

Animations with more than one word in its name wouldn't work correctly
David Catuhe 7 년 전
부모
커밋
f31c0ea8c6
4개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      Viewer/assets/templates/default/navbar.html
  2. 2 2
      Viewer/src/model/viewerModel.ts
  3. 1 1
      Viewer/src/viewer/defaultViewer.ts
  4. 1 0
      dist/preview release/what's new.md

+ 1 - 1
Viewer/assets/templates/default/navbar.html

@@ -457,7 +457,7 @@
             </button>
             <div class="menu-options">
                 {{#each animations}} {{#unless (eq ../selectedAnimation (add @index 1))}}
-                <button class="flex-container label-option-button animation-buttons" data-value="{{this.value}}">
+                <button class="flex-container label-option-button animation-buttons" data-value="{{this.value}} ">
                     <!-- <div> -->
                     <span class="icon types-icon"></span>
                     <span class="control-text animation-label">{{this.label}}</span>

+ 2 - 2
Viewer/src/model/viewerModel.ts

@@ -354,7 +354,7 @@ export class ViewerModel implements IDisposable {
      */
     protected _getAnimationByName(name: string): Nullable<IModelAnimation> {
         // can't use .find, noe available on IE
-        let filtered = this._animations.filter(a => a.name === name);
+        let filtered = this._animations.filter(a => a.name === name.trim());
         // what the next line means - if two animations have the same name, they will not be returned!
         if (filtered.length === 1) {
             return filtered[0];
@@ -377,7 +377,7 @@ export class ViewerModel implements IDisposable {
     }
 
     public setCurrentAnimationByName(name: string) {
-        let animation = this._getAnimationByName(name);
+        let animation = this._getAnimationByName(name.trim());
         if (animation) {
             if (this.currentAnimation && this.currentAnimation.state !== AnimationState.STOPPED) {
                 this.currentAnimation.stop();

+ 1 - 1
Viewer/src/viewer/defaultViewer.ts

@@ -198,7 +198,7 @@ export class DefaultViewer extends AbstractViewer {
                 var value = element.dataset["value"];
                 var label = element.querySelector("span.animation-label");
                 if (label && value) {
-                    this._updateAnimationType({ value, label: label.innerHTML });
+                    this._updateAnimationType({ value: value.trim(), label: label.innerHTML });
                 }
                 break;
             case "speed-option-button":

+ 1 - 0
dist/preview release/what's new.md

@@ -166,6 +166,7 @@
 - Drag and Drop only worked if a model was already loaded before ([RaananW](https://github.com/RaananW))
 - It was not possible to add new custom optimizers, only use existing ones ([RaananW](https://github.com/RaananW))
 - Button texts were truncated incorrectly ([RaananW](https://github.com/RaananW))
+- Animation names with more than one word didn't work correctly ([RaananW](https://github.com/RaananW))
 
 ### Loaders