Giter Site home page Giter Site logo

Comments (2)

danielearwicker avatar danielearwicker commented on May 25, 2024

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.

IProSoft avatar IProSoft commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.