Jump to content

getScreenPosition function of Widget class not always correct


photo

Recommended Posts

Posted

I'm trying to create a fullscreen ime in unigine, it makes unigine to draw the candidate/composition window. as I requested before, frustum has added getScreenPosition for Widget class, but this function/algorithm is not always correct, in most simple cases they are correct:

 

post-49-0-58714300-1321498706_thumb.jpg

correct position, of course, I modified WidgetEditText and WidgetEditLine to expose the cursor's pixel position in widget, this case the composition window and candidate window are correctly positioned

 

post-49-0-04740200-1321498711_thumb.jpg

In this case, I just want to set the object's name to Chinese, then you see the ime windows are positioned at wrong position.

 

so using this algorithm is not always correct.

Posted

I was made a mistake with getScreenPosition() functions.

They should look like:

 

int Widget::getScreenPositionX() const {
return gui->getMouseX() - mouse_x;
}

int Widget::getScreenPositionY() const {
return gui->getMouseY() - mouse_y;
}

×
×
  • Create New...