Example #1
0
bool SelectBoxState::touchRuler(Editor* editor, Ruler& ruler, int x, int y)
{
  int u, v;
  editor->editorToScreen(ruler.getPosition(), ruler.getPosition(), &u, &v);

  switch (ruler.getOrientation()) {
    case Ruler::Horizontal: return (y >= v-2 && y <= v+2);
    case Ruler::Vertical:   return (x >= u-2 && x <= u+2);
  }

  return false;
}
Example #2
0
bool SelectBoxState::touchRuler(Editor* editor, Ruler& ruler, int x, int y)
{
    gfx::Point pt = editor->editorToScreen(
                        gfx::Point(ruler.getPosition(), ruler.getPosition()));

    switch (ruler.getOrientation()) {
    case Ruler::Horizontal:
        return (y >= pt.y-2 && y <= pt.y+2);
    case Ruler::Vertical:
        return (x >= pt.x-2 && x <= pt.x+2);
    }

    return false;
}