Exemplo n.º 1
0
/*!
 * \brief ImageArea::mouseMoveEvent
 * \param e
 */
void ImageArea::mouseMoveEvent(QMouseEvent* e)
{
    if (e->buttons() & Qt::LeftButton) {
        setX2(e->x());
        setY2(e->y());
        setX2(std::min(e->x(), ImageStorage::getInstance().getImageWidth() - 1));
        setY2(std::min(e->y(), ImageStorage::getInstance().getImageHeight() - 1));
        update();
    } else {
    }
}
Exemplo n.º 2
0
/*!
 * \brief ImageArea::mouseReleaseEvent
 * \param e
 */
void ImageArea::mouseReleaseEvent(QMouseEvent* e)
{
    if (e->button() == Qt::LeftButton) {
        setX2(e->x());
        setY2(e->y());
        setX2(std::min(e->x(), ImageStorage::getInstance().getImageWidth() - 1));
        setY2(std::min(e->y(), ImageStorage::getInstance().getImageHeight() - 1));
        rectnotdrawing = true;
        emit rectChanged(bounds);
        update();
    }
}
Exemplo n.º 3
0
void MapNode::move(int x, int y) {
	if (!solid || map == NULL) {
		setX(getX() + x);
		setY(getY() + y);
		return;
	}
	setX(getX() + x);
	if (x < 0) {
		if (overlapsMap()) {
			setX(((getX() / map->getTileWidth()) + 1) * map->getTileWidth());
		}
	}
	if (x > 0) {
		if (overlapsMap()) {
			setX2((getX2() / map->getTileWidth()) * map->getTileWidth() - 1);
		}
	}
	setY(getY() + y);
	if (y < 0) {
		if (overlapsMap()) {
			setY(((getY() / map->getTileHeight()) + 1) * map->getTileHeight());
		}
	}
	if (y > 0) {
		if (overlapsMap()) {
			setY2((getY2() / map->getTileHeight()) * map->getTileHeight() - 1);
		}
	}
}
Exemplo n.º 4
0
QRealRectangle::QRealRectangle(qreal x1, qreal y1, qreal x2, qreal y2, Item* parent)
	:Item(parent), mRectangleImpl()
{
	mNeedScalingRect = true;
	setPen(QPen(Qt::black));
	setBrush(QBrush(QColor(), Qt::NoBrush));
	mDomElementType = pictureType;
	setX1(x1);
	setY1(y1);
	setX2(x2);
	setY2(y2);
}
Exemplo n.º 5
0
//----------------------------------------------------------
void Rect::lerp(const Rect & rect, float p) {

    float _x1 = coc::lerp(getX1(), rect.getX1(), p);
    float _x2 = coc::lerp(getX2(), rect.getX2(), p);
    float _y1 = coc::lerp(getY1(), rect.getY1(), p);
    float _y2 = coc::lerp(getY2(), rect.getY2(), p);

    setX1(_x1);
    setX2(_x2);
    setY1(_y1);
    setY2(_y2);
}
Exemplo n.º 6
0
PointPort::PointPort(qreal x, qreal y, Item *parent) : Item(parent), mPointImpl(), mType("NonTyped")
{
	mNeedScalingRect = true;
	mRadius = 2;
	setX1(x - mRadius * 1.6);
	setY1(y - mRadius * 1.6);
	setX2(x + mRadius * 1.6);
	setY2(y + mRadius * 1.6);
	mUnrealRadius = mRadius * 1.6;
	setPen(QPen(Qt::blue));
	setBrush(QBrush(Qt::blue, Qt::SolidPattern));
	mDomElementType = portType;
}
Exemplo n.º 7
0
QRealRectangle::QRealRectangle(const QRealRectangle &other)
	:Item(), mRectangleImpl()
{
	mNeedScalingRect = other.mNeedScalingRect ;
	setPen(other.pen());
	setBrush(other.brush());
	mDomElementType = pictureType;
	setX1(other.x1());
	setX2(other.x2());
	setY1(other.y1());
	setY2(other.y2());
	mListScalePoint = other.mListScalePoint;
	setPos(other.x(), other.y());
}
Exemplo n.º 8
0
PointPort::PointPort(const PointPort &other)
	:Item(), mPointImpl()
{
	mNeedScalingRect = other.mNeedScalingRect ;
	setPen(other.pen());
	setBrush(other.brush());
	mDomElementType = portType;
	setX1(other.x1());
	setX2(other.x2());
	setY1(other.y1());
	setY2(other.y2());
	mRadius = other.mRadius;
	mListScalePoint = other.mListScalePoint;
	mType = other.mType;
	setPos(other.x(), other.y());
}
Exemplo n.º 9
0
void Rect::setRect( RectBase rect ) {
    setX1(rect.x1);
    setY1(rect.y1);
    setX2(rect.x2);
    setY2(rect.y2);
}