本文整理汇总了C++中ToolHandler::isRuler方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolHandler::isRuler方法的具体用法?C++ ToolHandler::isRuler怎么用?C++ ToolHandler::isRuler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolHandler
的用法示例。
在下文中一共展示了ToolHandler::isRuler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPointToTmpStroke
void InputHandler::addPointToTmpStroke(GdkEventMotion * event) {
XOJ_CHECK_TYPE(InputHandler);
double zoom = xournal->getZoom();
double x = event->x / zoom;
double y = event->y / zoom;
bool presureSensitivity = xournal->getControl()->getSettings()->isPresureSensitivity();
if (tmpStroke->getPointCount() > 0) {
Point p = tmpStroke->getPoint(tmpStroke->getPointCount() - 1);
if (hypot(p.x - x, p.y - y) < PIXEL_MOTION_THRESHOLD) {
return; // not a meaningful motion
}
}
ToolHandler * h = xournal->getControl()->getToolHandler();
if (h->isRuler()) {
int count = tmpStroke->getPointCount();
if (count < 2) {
tmpStroke->addPoint(Point(x, y));
} else {
tmpStroke->setLastPoint(x, y);
}
Point p = tmpStroke->getPoint(0);
//Draw the initial stroke or else rerender it
//The rerenderelement is bugged up on Debian Squeeze
//Until this is fixed just repaint.
this->redrawable->rerenderElement(this->tmpStroke);
this->redrawable->repaintElement(this->tmpStroke);
return;
}
if (presureSensitivity) {
double pressure = Point::NO_PRESURE;
if (h->getToolType() == TOOL_PEN) {
if (getPressureMultiplier((GdkEvent *) event, pressure)) {
pressure = pressure * tmpStroke->getWidth();
} else {
pressure = Point::NO_PRESURE;
}
}
tmpStroke->setLastPressure(pressure);
}
tmpStroke->addPoint(Point(x, y));
drawTmpStroke();
}