@visactor/vtable
Version:
canvas table width high performance
30 lines (29 loc) • 1.29 kB
JavaScript
export function getIconAndPositionFromTarget(target) {
var _a;
if (!target) return;
const icon = (null === (_a = target.role) || void 0 === _a ? void 0 : _a.startsWith("icon")) ? target : "richtext" === target.type ? target._currentHoverIcon : void 0;
return icon ? "richtext" === target.type ? {
icon: icon,
position: {
left: target.globalAABBBounds.x1 + icon.globalAABBBounds.x1,
right: target.globalAABBBounds.x1 + icon.globalAABBBounds.x2,
top: target.globalAABBBounds.y1 + icon.globalAABBBounds.y1,
bottom: target.globalAABBBounds.y1 + icon.globalAABBBounds.y2,
width: icon.globalAABBBounds.x2 - icon.globalAABBBounds.x1,
height: icon.globalAABBBounds.y2 - icon.globalAABBBounds.y1
},
type: "richtext-icon"
} : {
icon: icon,
position: {
left: icon.globalAABBBounds.x1,
right: icon.globalAABBBounds.x2,
top: icon.globalAABBBounds.y1,
bottom: icon.globalAABBBounds.y2,
width: icon.globalAABBBounds.x2 - icon.globalAABBBounds.x1,
height: icon.globalAABBBounds.y2 - icon.globalAABBBounds.y1
},
type: "icon"
} : void 0;
}
//# sourceMappingURL=icon.js.map