Pregunta

In paperjs I can not find a way to re size the text item pointText. I would like my users to be able to click to select the text item, then when the handles appear be able to drag to re size the text (keeping the aspect ratio). No where in the docs is it clear or doable. I have a feeling that I'm missing something or its not possible.

¿Fue útil?

Solución

You could do a hitTest only on the bounds of PointText items.

var text = new PointText({
    point: [50, 50],
    content: 'The contents of the point text',
    fillColor: 'black',
    fontSize: 25,
    selected: true
});

function onMouseDown(event){
    text.res = project.hitTest(event.point, {
            type: 'PointText',
            bounds:true
        }
    );
    console.log(text.res.name);
}

Then parse the result to make sure it's a corner and perform a scale centered on the opposite corner on the next onMouseUp.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top