Forum

The Text Area bug the scene !

26 July 2018 11:17
Hello everybody

Is there any possibility to disable the actions of some letters on the 3D view when writing in a textarea ?
The "P" literaly freeze the scene as soon as it's hit ! ! !

An example here
26 July 2018 11:39
A second hit on "P" make restart the scene activity…
"Pause" shortcut… sorry…
26 July 2018 21:44
First of all, to get rid of the Pause-Key problem, you need to disable the Pause-Key in your .js file:
 m_app.init({
        canvas_container_id: "main_canvas_container",
        key_pause_enabled:false,  // < - add this line!!!!!!!!!!!!!!!!!!!
        callback: init_cb,
        physics_enabled: false,
        background_color: [1, 1, 1, 1],
        alpha: true,
        autoresize: true,
        assets_dds_available: !DEBUG,
        assets_min50_available: !DEBUG,
        console_verbose: true
    });


Now you can use onFocus / onBlur in your textarea tag to control key detection as you wish. The idea is to block the engine's key detection when the user enters the textarea for typing (=onFocus) and re-allow it when the user has left the textarea and clicked on the "ENTER" button (=onBlur).

In the HTML file, replace your textarea tags with the following:
<textarea onFocus="disableEngineKeyDetection()" onBlur="enableEngineKeyDetection()" spellcheck="false" id = "myText" cols="15" rows="1" maxlength="15">hello</textarea>

Then, in the HTML file, in the HEAD section, add the following javascript:
<script type="text/javascript">

function disableEngineKeyDetection() {
  b4w.require("app").disable_camera_controls();
}

function enableEngineKeyDetection() {
  b4w.require("app").enable_camera_controls();
}

</script>
27 July 2018 12:37
Waouw !
Thank you for this fully answer ! ! !
Problem solved !
Blend4web is really an awesome tool, and you're such an awesome team !
 
Please register or log in to leave a reply.