当我将文本设置为链接时,设置边界形状,并将命中区域设置为边界形状,如果textAlign ='center',则我的命中区域关闭。有任何想法吗?在createjs textAlign中造成命中区域未对齐
var linkColor = "#0000ff";
var linkFont = "bold 14px Times";
var presentationLink = new createjs.Text("View Presentation", linkFont, linkColor);
presentationLink.textAlign = "left";
presentationLink.maxWidth = 170;
presentationLink.x = 300;
presentationLink.y = 125;
stage.addChild(presentationLink);
var plBounds = presentationLink.getTransformedBounds();
var s = new createjs.Shape().set({ x: plBounds.x, y: plBounds.y + plBounds.height });
s.graphics.s(linkColor).moveTo(0, 0).lineTo(plBounds.width, 0);
stage.addChild(s);
var hitAreaForPLink = new createjs.Shape(new createjs.Graphics().beginFill("#ffffff").drawRect(-10, -10, plBounds.width + 20, plBounds.height + 10));
presentationLink.hitArea = hitAreaForPLink;
stage.enableMouseOver();
presentationLink.on("mouseover", function() {
presentationLink.cursor = "pointer";
});
顺便说一句,你不需要在mouseover上设置光标。这就是'cursor'的作用(设置一个将在鼠标悬停时应用的光标)。 – gskinner