Comments (6)
Sure, but keep in mind it doesn't work without the "align" exception in _deriveSurrogateStyle
:
case 'textAlign':
style.align = this._input_style.textAlign;
break
And I of course meant that I put the code in my previous post in _updateSurrogate
function, apologies.
from pixi-text-input.
It would probably be easy to fix by adding an exception for it to the _deriveSurrogateStyle?
yes that should be a trivial fix. let me know if it works, otherwise i'll take a look.
from pixi-text-input.
I tried adding it there... The TextStyle gets the correct align
property but for some reason the surrogate still stays to the left. Can you take a look?
from pixi-text-input.
Okay, I figured it out when trying to get sleep last night... 😄 Pixi.Text is of course only the width of the text it contains, so it has to be positioned manually, so in _deriveSurrogateStyle
I put:
switch (this._surrogate.style.align) {
case 'left':
this._surrogate.x = padding[3];
break;
case 'center':
this._surrogate.x = input_bounds.width * 0.5 - this._surrogate.width * 0.5;
break;
case 'right':
this._surrogate.x = input_bounds.width - padding[1] - this._surrogate.width;
break;
}
And it works.
from pixi-text-input.
Nice one! Can I merge this code?
from pixi-text-input.
from pixi-text-input.
Related Issues (20)
- Bug : when deleting, onkeydown not fire HOT 3
- Request : method dispose to clean memory HOT 3
- Bug : inconsistent behavior when using paddingTop HOT 1
- Bug in mobile mode on Chrome desktop when using tab HOT 2
- Bug on iOS, need to click twice on the input to open the keyboard HOT 1
- Set input type HOT 2
- Typings missing
- Duplicate identifier 'substituteText' in ts
- Does not handle type 'password' HOT 3
- Support for Typescript is missing
- Anchor property seems to be missing
- Pixi 6
- Error on adding input textfield to stage
- Input Width HOT 2
- Font size mismatch between focus and default states
- Focus Color
- Wheel Events
- NPM
- PIXI v7 Support HOT 6
- Dragging causes a framerate dip HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixi-text-input.