@visactor/vtable
Version:
canvas table width high performance
36 lines (33 loc) • 1.48 kB
JavaScript
;
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;
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.getIconAndPositionFromTarget = void 0, exports.getIconAndPositionFromTarget = getIconAndPositionFromTarget;
//# sourceMappingURL=icon.js.map