Skip to content

Commit

Permalink
figured out tutorial highlight draw bug
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Wicenec committed Jan 17, 2024
1 parent 06463c4 commit 21aa3a7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,27 @@ export class Tutorial {
}

highlightStepTarget = (target: JQuery<HTMLElement>): void => {
const eagle = Eagle.getInstance()
if(TutorialSystem.activeTutCurrentStep.getAlternateHightlightTargetFunc() != null){
target = TutorialSystem.activeTutCurrentStep.getAlternateHightlightTargetFunc()()
}

console.log(target)

//in order to darken the screen save the selection target, we must add divs on each side of the element.
const coords = target.offset()
const docWidth = window.innerWidth
const top_actual = Math.round(coords.top)//distance of the top of the element from the top of the document
const right = coords.left + $(target).outerWidth()
let right = coords.left + $(target).outerWidth()
const left = docWidth - coords.left
const targetHeight = Math.round($(target).outerHeight())
const bottom_actual = Math.round(coords.top + targetHeight) //distance from the bottom of the target element to the bottom of the document
let targetHeight = Math.round($(target).outerHeight())
let bottom_actual = Math.round(coords.top + targetHeight) //distance from the bottom of the target element to the bottom of the document

if(target.parents('#logicalGraphParent').length){
targetHeight = Math.round(targetHeight*eagle.globalScale())
right = coords.left+$(target).outerWidth() *eagle.globalScale()
bottom_actual = Math.round(coords.top + targetHeight)
}

//i am appending these once if they dont exist. they are then adjusted for each step. and finally removed when exiting the tutorial
if ($('.tutorialHighlight').length === 0) {
Expand Down

0 comments on commit 21aa3a7

Please sign in to comment.