Jump to content

PIXI & DOM Inpus


Goga
 Share

Recommended Posts

Hello!

There's no clear article on that, but Accessability package of pixijs has all necessary code inside. Also you can copy something from https://github.com/Mwni/PIXI.TextInput .

Basically, need to take calculated transform matrix from pixi element and put it to css transform of DOM element.

Edited by ivan.popelyshev
Link to comment
Share on other sites

  • 2 weeks later...

sample use:
html page section

<input id = "number1_input" type = "number" min = "0" max = "100000" value = "10" onchange = "html_inputChange_Sayi1 ()" onkeyup = "html_inputChange_Sayi1 ()" style = "visibility: hidden">

 

window.addEventListener('resize', resize);
window.addEventListener('orientationchange', resize);

resize();
var w,h;
function resize() {

    
    
    var canvasRatio = 800 / 1440; ////canvas genişlik ve canvas yükseklik
    var windowRatio = window.innerHeight / window.innerWidth;

    

    if (windowRatio < canvasRatio) {
        h = window.innerHeight;  
        w = h / canvasRatio;
        
    } else {
        w = window.innerWidth;
        h = w * canvasRatio;
        
        
}
    app.view.style.width = w + 'px';
    app.view.style.height = h + 'px';
    resizeHtmlElement();
}


function resizeHtmlElement(){

    var sayı1_size_degis=document.getElementById('number1_input');

    
    sayı1_size_degis.style.width=w*8/100+'px';
    sayı1_size_degis.style.left=-w*25/100+'px';    
    sayı1_size_degis.style.height=h*6/100+"px";
    sayı1_size_degis.style.top=-h*75/100+'px'; 
    sayı1_size_degis.style["font-size"]=w*2.6/100+'px';

    sayı1_size_degis.style.visibility="visible"
    

  }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...