@@ -506,6 +506,7 @@ export const nodeLifecycleMethods = {
506506 clearTimeout ( this . tooltipTimer ) ;
507507 this . tooltipTimer = null ;
508508 }
509+ this . hideVueCompatTooltip ( ) ;
509510 this . hoverElement = null ;
510511 this . tooltipElement = null ;
511512 this . showTooltip = false ;
@@ -518,6 +519,80 @@ export const nodeLifecycleMethods = {
518519 this . _vueCompatCanvasHandlers = { handlePointerMove, handlePointerLeave } ;
519520 } ,
520521
522+ showVueCompatTooltip ( element , pointerPosition ) {
523+ const text = this . tooltips ?. [ element ] ;
524+ const clientX = Number ( pointerPosition ?. clientX ) ;
525+ const clientY = Number ( pointerPosition ?. clientY ) ;
526+ if ( ! text || ! Number . isFinite ( clientX ) || ! Number . isFinite ( clientY ) || typeof document === "undefined" ) {
527+ return ;
528+ }
529+
530+ if ( ! this . _vueCompatTooltip ) {
531+ const tooltip = document . createElement ( "div" ) ;
532+ tooltip . dataset . resolutionMasterTooltip = "true" ;
533+ tooltip . style . cssText = [
534+ "position:fixed" ,
535+ "z-index:100000" ,
536+ "pointer-events:none" ,
537+ "box-sizing:border-box" ,
538+ "max-width:266px" ,
539+ "padding:8px 8px 4px" ,
540+ "border:1px solid rgba(200,200,200,0.3)" ,
541+ "border-radius:6px" ,
542+ "background:linear-gradient(180deg, rgba(45,45,45,0.95), rgba(35,35,35,0.95))" ,
543+ "box-shadow:2px 2px 0 rgba(0,0,0,0.3)" ,
544+ "color:#fff" ,
545+ "font:12px Arial, sans-serif" ,
546+ "line-height:16px" ,
547+ "white-space:normal"
548+ ] . join ( ";" ) ;
549+ document . body . appendChild ( tooltip ) ;
550+ this . _vueCompatTooltip = tooltip ;
551+ }
552+
553+ const tooltip = this . _vueCompatTooltip ;
554+ tooltip . textContent = text ;
555+ tooltip . style . display = "block" ;
556+ tooltip . style . visibility = "hidden" ;
557+ tooltip . style . left = "0px" ;
558+ tooltip . style . top = "0px" ;
559+
560+ const tooltipRect = tooltip . getBoundingClientRect ( ) ;
561+ const viewportWidth = document . documentElement ?. clientWidth || globalThis . innerWidth || 0 ;
562+ const viewportHeight = document . documentElement ?. clientHeight || globalThis . innerHeight || 0 ;
563+ const viewportMargin = 8 ;
564+ let left = clientX + 15 ;
565+ let top = clientY - tooltipRect . height - 10 ;
566+
567+ if ( viewportWidth > 0 && left + tooltipRect . width > viewportWidth - viewportMargin ) {
568+ left = clientX - tooltipRect . width - 15 ;
569+ }
570+ if ( top < viewportMargin ) {
571+ top = clientY + 20 ;
572+ }
573+ if ( viewportWidth > 0 ) {
574+ left = Math . max ( viewportMargin , Math . min ( left , viewportWidth - tooltipRect . width - viewportMargin ) ) ;
575+ }
576+ if ( viewportHeight > 0 ) {
577+ top = Math . max ( viewportMargin , Math . min ( top , viewportHeight - tooltipRect . height - viewportMargin ) ) ;
578+ }
579+
580+ tooltip . style . left = `${ Math . round ( left ) } px` ;
581+ tooltip . style . top = `${ Math . round ( top ) } px` ;
582+ tooltip . style . visibility = "visible" ;
583+ } ,
584+
585+ hideVueCompatTooltip ( ) {
586+ if ( this . _vueCompatTooltip ) {
587+ this . _vueCompatTooltip . style . display = "none" ;
588+ }
589+ } ,
590+
591+ teardownVueCompatTooltip ( ) {
592+ this . _vueCompatTooltip ?. remove ?. ( ) ;
593+ this . _vueCompatTooltip = null ;
594+ } ,
595+
521596 teardownVueCompatCanvasEvents ( ) {
522597 if ( this . _vueCompatHeightRedrawFrame != null ) {
523598 if ( typeof cancelAnimationFrame === 'function' ) {
@@ -536,6 +611,7 @@ export const nodeLifecycleMethods = {
536611 this . _vueCompatCanvasElement = null ;
537612 this . _vueCompatCanvasHandlers = null ;
538613 this . _vueCompatForwardingNodePointer = false ;
614+ this . teardownVueCompatTooltip ( ) ;
539615 this . teardownVueCompatCanvasLayout ( ) ;
540616 } ,
541617
0 commit comments