|
Hi there, I just realized, that when I use Screen.height from within an editor window, it gives my not the actual space I have to draw the things inside. The problem => the header bar is included as well in this calculation for the height! I measured it to be around 22 pixels, on a Window 7 / Unity Pro setup. Probably this value differs with other setting? Is there a constant or something that gives back that value?
(comments are locked)
|
|
To get the draw area of an editor Window, use EditorWindow.position. Don't be fooled by the name. It's a Rect that indicates the draw area. Edit: Added some example code. Great. But to calculate weather or not the mouse is inside this Rect, I still need to know how big the offset is.
Feb 12 '12 at 04:07 PM
swisscoder
Actually this does not work! EditorWindow.position does give back the size of the total EditorWindow! EditorWindow.position.height = screen.Size +1 This does definitely not take the offset for the title bar into account.
Feb 12 '12 at 04:41 PM
swisscoder
If it doesn't work, then my rather complex EditorWindow implementation must be working by magic. :-) I've added some example code derived from my own implementation. I've never had to adjust the position Rect take the tile bar into account.
Feb 12 '12 at 05:29 PM
SteveFSP
Hmm, you are right! What a shame, I probably read 60 as 80, else I can not explain it. Now I had the following results: Clicked at: (274.0, 6.0) - Was 6 Pixel below the title bar => correct drawArea: (left:314.00, top:197.00, width:952.00, height:463.00) Screen.height: 485 Height is 22 Pixel smaller => correct! Maybe work on sunday made me missinterpret it ;) Thank you a lot Steve!!!
Feb 12 '12 at 06:28 PM
swisscoder
(comments are locked)
|
