Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top