浏览代码

Merge pull request #8510 from toledoal/curve-bug-drag

Fix strange curve on drag
sebavan 5 年之前
父节点
当前提交
3730fc105e

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

@@ -9,7 +9,7 @@
 - Reflection probes can now be used to give accurate shading with PBR ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Added SubSurfaceScattering on PBR materials ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Added editing of PBR materials, Post processes and Particle fragment shaders in the node material editor ([Popov72](https://github.com/Popov72))
-- Added Curve editor to manage selected entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
+- Added Curve editor to manage entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
 - Added support in `ShadowGenerator` for fast fake soft transparent shadows ([Popov72](https://github.com/Popov72))
 - Added support for **thin instances** for faster mesh instances. [Doc](https://doc.babylonjs.com/how_to/how_to_use_thininstances) ([Popov72](https://github.com/Popov72))
 

+ 4 - 3
inspector/src/components/actionTabs/tabs/propertyGrids/animations/animationCurveEditorComponent.tsx

@@ -645,7 +645,7 @@ export class AnimationCurveEditorComponent extends React.Component<
   setFlatTangent() {
     if (this.state.selected !== null) {
       let animation = this.state.selected;
-      this.setState({ isFlatTangentMode: !this.state.isFlatTangentMode }, () =>
+      this.setState({ isFlatTangentMode: true }, () =>
         this.selectAnimation(animation)
       );
     }
@@ -833,6 +833,7 @@ export class AnimationCurveEditorComponent extends React.Component<
     } else {
       flattened = keyframes;
     }
+    this.setState({ isFlatTangentMode: false });
     return flattened;
   }
 
@@ -1078,12 +1079,12 @@ export class AnimationCurveEditorComponent extends React.Component<
       let prevKeyframe = keyframes[i - 1];
       if (nextKeyframe !== undefined) {
         let distance = keyframes[i + 1].frame - key.frame;
-        defaultWeight = distance * 0.33;
+        defaultWeight = distance * 1; // Adjust for scaled
       }
 
       if (prevKeyframe !== undefined) {
         let distance = key.frame - keyframes[i - 1].frame;
-        defaultWeight = distance * 0.33;
+        defaultWeight = distance * 1; // Adjust for scaled
       }
 
       if (inT !== null) {

+ 2 - 0
inspector/src/components/actionTabs/tabs/propertyGrids/animations/svgDraggableArea.tsx

@@ -145,6 +145,8 @@ export class SvgDraggableArea extends React.Component<
               point.isRightActive = true;
             } else {
               point.keyframePoint = coord;
+              point.isRightActive = false;
+              point.isLeftActive = false;
             }
             this.props.updatePosition(point, this._currentPointId);
           }