Comments (2)
Do you mean align vertically as in adjust the y-position? You mention start drawing text at width/2 which sounds like horizontal alignment (and that is already built into Carota - the demo has toolbar buttons for left/right/center/justify).
For vertical alignment, it's much simpler - you just move the canvas coordinate origin downward (and for handling mouse events in the editor, you move the coordinate upward). This would be a "whole document" setting, not something applying to selected text. There's nowhere in Carota's own JSON format for such settings. But it would be easy to add them to the outside.
To demo this I've added a setVerticalAlignment
function to the editor and in the demo page it now has a dropdown to let the user adjust it.
See updated demo: http://earwicker.com/carota - the right-most toolbar control.
from carota.
Hi
Yes - that was vertical alignment :-) Thanks for reply and demo!
I hava another question: is there way to get text real height in px of writen text ?
Or is there way to limit textarea to specified width/height, example: user ads text that is formated to font 72 and its higher than 200px, and it's auto resized to fit 200px, ex font 54.
Regards Artur
from carota.
Related Issues (20)
- Problem building carota with webmake HOT 2
- blurry on retina display
- Missing file ? HOT 1
- Exception when entering first character HOT 1
- could do with some guidance on codes and edit filters
- It cannot input chinese character HOT 3
- Multiple editors on one page HOT 4
- limitations of text rendering in canvas HOT 1
- probable bug in file carota-debug.js HOT 3
- Update npm with this! HOT 1
- Save to Microsoft Word Format HOT 1
- Background Color
- Spacing gets all screwy on custom fonts HOT 1
- How to tear down / destroy / remove?
- Is node-canvas supported? HOT 1
- Change in Font, size, Allignment, color and check mark are not reflecting in the dialog box
- Two Column
- Page View
- Restore the project? HOT 2
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 carota.