Просмотр исходного кода

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js into svgimage-rotation

Popov72 5 лет назад
Родитель
Сommit
0cc46fbfca

+ 4 - 4
Playground/index.html

@@ -43,13 +43,13 @@
     <script src="node_modules/monaco-editor/dev/vs/loader.js"></script>
 
     <!-- Extensions -->
-    <script src="https://rawgit.com/BabylonJS/Extensions/master/ClonerSystem/src/babylonx.cloner.js" async></script>
-    <script src="https://rawgit.com/BabylonJS/Extensions/master/CompoundShader/src/babylonx.CompoundShader.js"
+    <script src="https://cdn.jsdelivr.net/gh/BabylonJS/Extensions@master/ClonerSystem/src/babylonx.cloner.js" async></script>
+    <script src="https://cdn.jsdelivr.net/gh/BabylonJS/Extensions@master/CompoundShader/src/babylonx.CompoundShader.js"
         async></script>
 
     <!-- Scene Manager -->
-    <script src="https://mackeyk24.github.io/toolkit/babylon.manager.js"></script>
-    <script src="https://mackeyk24.github.io/toolkit/babylon.navmesh.js"></script>
+    <script src="https://cdn.jsdelivr.net/gh/MackeyK24/MackeyK24.github.io@master/toolkit/babylon.manager.js"></script>
+    <script src="https://cdn.jsdelivr.net/gh/MackeyK24/MackeyK24.github.io@master/toolkit/babylon.navmesh.js"></script>
 </head>
 
 <body>

+ 5 - 0
Playground/js/examples.js

@@ -85,6 +85,11 @@ class Examples {
 
         this.fpsLabel.style.display = 'none';
         this.toggleExamplesButtons.call(this, true);
+        this.exampleList.querySelectorAll("img").forEach(function(img) {
+            if(!img.src) {
+                img.src = img.getAttribute("data-src");
+            }
+        })
     };
 
     /**

+ 1 - 1
Playground/js/main.js

@@ -548,7 +548,7 @@ class Main {
                                 example.id = ii;
 
                                 var exampleImg = document.createElement("img");
-                                exampleImg.src = this.scripts[i].samples[ii].icon.replace("icons", "https://doc.babylonjs.com/examples/icons");
+                                exampleImg.setAttribute("data-src", this.scripts[i].samples[ii].icon.replace("icons", "https://doc.babylonjs.com/examples/icons"));
                                 exampleImg.setAttribute("onClick", "document.getElementById('PGLink_" + this.scripts[i].samples[ii].PGID + "').click();");
 
                                 var exampleContent = document.createElement("div");

+ 19 - 6
Playground/js/monacoCreator.js

@@ -86,12 +86,25 @@ class MonacoCreator {
     };
 
     setupDefinitionWorker(libContent) {
-        this.definitionWorker = new Worker('js/definitionWorker.js');
-        this.definitionWorker.addEventListener('message', ({ data }) => {
-            this.deprecatedCandidates = data.result;
-            this.analyzeCode();
-        });
-        this.definitionWorker.postMessage({ code: libContent });
+        // What is the reason behind this worker?
+
+        // this.definitionWorker = new Worker('js/definitionWorker.js');
+        // this.definitionWorker.addEventListener('message', ({ data }) => {
+        //     this.deprecatedCandidates = data.result;
+        //     this.analyzeCode();
+        // });
+        // this.definitionWorker.postMessage({ code: libContent });
+        this.deprecatedCandidates = [
+            "FromFloatArray",
+            "FromFloatArrayToRef",
+            "getStrideSize",
+            "getStrideSize",
+            "getOffset",
+            "rgb",
+            "xy",
+            "xyz",
+            "fieldOfView"
+          ];
     }
 
     isDeprecatedEntry(details) {

+ 15 - 2
src/Cameras/Inputs/arcRotateCameraPointersInput.ts

@@ -59,6 +59,15 @@ export class ArcRotateCameraPointersInput extends BaseCameraPointersInput {
     public pinchDeltaPercentage = 0;
 
     /**
+     * When useNaturalPinchZoom is true, multi touch zoom will zoom in such
+     * that any object in the plane at the camera's target point will scale
+     * perfectly with finger motion.
+     * Overrides pinchDeltaPercentage and pinchPrecision.
+     */
+    @serialize()
+    public useNaturalPinchZoom: boolean = false;
+
+    /**
      * Defines the pointer panning sensibility or how fast is the camera moving.
      */
     @serialize()
@@ -135,11 +144,15 @@ export class ArcRotateCameraPointersInput extends BaseCameraPointersInput {
         var direction = this.pinchInwards ? 1 : -1;
 
         if (this.multiTouchPanAndZoom) {
-            if (this.pinchDeltaPercentage) {
+            if (this.useNaturalPinchZoom) {
+                this.camera.radius = this.camera.radius *
+                    Math.sqrt(previousPinchSquaredDistance) / Math.sqrt(pinchSquaredDistance);
+            } else if (this.pinchDeltaPercentage) {
                 this.camera.inertialRadiusOffset +=
                     (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *
                     this.camera.radius * this.pinchDeltaPercentage;
-            } else {
+            }
+            else {
                 this.camera.inertialRadiusOffset +=
                     (pinchSquaredDistance - previousPinchSquaredDistance) /
                     (this.pinchPrecision * direction *

+ 23 - 0
src/Cameras/arcRotateCamera.ts

@@ -298,6 +298,29 @@ export class ArcRotateCamera extends TargetCamera {
     }
 
     /**
+     * Gets or Set the pointer use natural pinch zoom to override the pinch precision
+     * and pinch delta percentage.
+     * When useNaturalPinchZoom is true, multi touch zoom will zoom in such
+     * that any object in the plane at the camera's target point will scale
+     * perfectly with finger motion.
+     */
+    public get useNaturalPinchZoom(): boolean {
+        var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
+        if (pointers) {
+            return pointers.useNaturalPinchZoom;
+        }
+
+        return false;
+    }
+
+    public set useNaturalPinchZoom(value: boolean) {
+        var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
+        if (pointers) {
+            pointers.useNaturalPinchZoom = value;
+        }
+    }
+
+    /**
      * Gets or Set the pointer panning sensibility or how fast is the camera moving.
      */
     public get panningSensibility(): number {

+ 1 - 0
what's new.md

@@ -222,6 +222,7 @@
 - Improving visual quality on SSAO2 shader ([CraigFeldspar](https://github.com/CraigFeldspar))
 - Fixed a bug where changing the sample count on `PostProcess` would not update the WebGL Texture ([CraigFeldspar](https://github.com/CraigFeldspar))
 - Fixed multi camera support in defaultRenderingPipeline depth of field ([sebavan](http://www.github.com/sebavan))
+- Added a new NaturalPinchZoom for the ArcRotateCamera, which adds a new pinch type that is based on the camera and pinch distance. ([rwedoff](https://github.com/rwedoff))
 
 ### Viewer