浏览代码

Merge pull request #6590 from shinyoshiaki/fix-InputText

add disable prompt option for OculusQuest
David Catuhe 6 年之前
父节点
当前提交
583ecd8086
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 3 0
      dist/preview release/what's new.md
  2. 3 1
      gui/src/2D/controls/inputText.ts

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

@@ -78,6 +78,9 @@
 ### Ray
 - Added `Ray.intersectsAxis` to translate screen to axis coordinates without checking collisions ([horusscope](https://github.com/horusscope))
 
+### GUI  
+- Added `disableMobilePrompt` option to InputText for OculusQuest(and other android base VR devices) ([shinyoshiaki](https://github.com/shinyoshiaki))
+
 ### Documentation
 - Added a note on shallow bounding of getBoundingInfo ([tibotiber](https://github.com/tibotiber))
 

+ 3 - 1
gui/src/2D/controls/inputText.ts

@@ -50,6 +50,8 @@ export class InputText extends Control implements IFocusableControl {
 
     /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
     public promptMessage = "Please enter text:";
+    /** Force disable prompt on mobile device */
+    public disableMobilePrompt = false;
 
     /** Observable raised when the text changes */
     public onTextChangedObservable = new Observable<InputText>();
@@ -364,7 +366,7 @@ export class InputText extends Control implements IFocusableControl {
 
         this.onFocusObservable.notifyObservers(this);
 
-        if (navigator.userAgent.indexOf("Mobile") !== -1) {
+        if (navigator.userAgent.indexOf("Mobile") !== -1 && !this.disableMobilePrompt) {
             let value = prompt(this.promptMessage);
 
             if (value !== null) {