package ui

func (d *Driver) hoverStartEvent(h hoverable, inBounds bool) {
	if inBounds && !h.hoverState() {
		//log.Printf("hoverable false -> true")
		h.setHoverState(true)
	}
}

func (d *Driver) hoverEndEvent(h hoverable, inBounds bool) {
	if !inBounds && h.hoverState() {
		//log.Printf("hoverable true -> false")
		h.setHoverState(false)
	}
}

func (d *Driver) mouseDownEvent(c clickable, inBounds, wasDown, isDown bool) {
	if inBounds && !wasDown && isDown {
		//log.Printf("mouse down false -> true")
		c.setMouseDownState(true)
	}
}

func (d *Driver) mouseClickEvent(c clickable, inBounds, wasDown, isDown bool) {
	if inBounds && wasDown && !isDown {
		//log.Printf("mouse click")
		c.registerMouseClick()
	}
}

func (d *Driver) mouseUpEvent(c clickable, inBounds, wasDown, isDown bool) {
	if inBounds {
		if wasDown && !isDown {
			//log.Printf("mouse down true -> false")
			c.setMouseDownState(false)
		}
	} else {
		if wasDown {
			//log.Printf("mouse down true -> false")
			c.setMouseDownState(false)
		}
	}
}
