src/gldraw.cpp

changeset 526
b29b6fc45ba9
parent 522
afa691788bdb
child 527
47c068f2e7e3
equal deleted inserted replaced
525:4f6e46a3bfc3 526:b29b6fc45ba9
1078 if (mid || (left && shift)) 1078 if (mid || (left && shift))
1079 { m_panX += 0.03f * dx * (zoom() / 7.5f); 1079 { m_panX += 0.03f * dx * (zoom() / 7.5f);
1080 m_panY -= 0.03f * dy * (zoom() / 7.5f); 1080 m_panY -= 0.03f * dy * (zoom() / 7.5f);
1081 m_panning = true; 1081 m_panning = true;
1082 } elif (left && !m_rangepick && camera() == Free) 1082 } elif (left && !m_rangepick && camera() == Free)
1083
1084 { m_rotX = m_rotX + (dy); 1083 { m_rotX = m_rotX + (dy);
1085 m_rotY = m_rotY + (dx); 1084 m_rotY = m_rotY + (dx);
1086 1085
1087 clampAngle (m_rotX); 1086 clampAngle (m_rotX);
1088 clampAngle (m_rotY); 1087 clampAngle (m_rotY);
1545 1544
1546 if (obj->vertices() >= 2) 1545 if (obj->vertices() >= 2)
1547 { for (int i = 0; i < obj->vertices(); ++i) 1546 { for (int i = 0; i < obj->vertices(); ++i)
1548 verts << obj->getVertex (i); 1547 verts << obj->getVertex (i);
1549 } elif (obj->getType() == LDObject::Subfile) 1548 } elif (obj->getType() == LDObject::Subfile)
1550
1551 { LDSubfile* ref = static_cast<LDSubfile*> (obj); 1549 { LDSubfile* ref = static_cast<LDSubfile*> (obj);
1552 QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline); 1550 QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline);
1553 1551
1554 for (LDObject * obj : objs) 1552 for (LDObject* obj : objs)
1555 { verts << getVertices (obj); 1553 { verts << getVertices (obj);
1556 delete obj; 1554 delete obj;
1557 } 1555 }
1558 } 1556 }
1559 1557
1663 info.oy = y; 1661 info.oy = y;
1664 info.img = img; 1662 info.img = img;
1665 1663
1666 if (info.lw == 0) 1664 if (info.lw == 0)
1667 info.lw = (info.lh * img->width()) / img->height(); 1665 info.lw = (info.lh * img->width()) / img->height();
1668
1669 elif (info.lh == 0) 1666 elif (info.lh == 0)
1670 info.lh = (info.lw * img->height()) / img->width(); 1667 info.lh = (info.lw * img->height()) / img->width();
1671 1668
1672 const Axis x2d = cameraAxis (false, cam), 1669 const Axis x2d = cameraAxis (false, cam),
1673 y2d = cameraAxis (true, cam); 1670 y2d = cameraAxis (true, cam);
1674 1671 const double negXFac = g_FixedCameras[cam].negX ? -1 : 1,
1675 double negXFac = g_FixedCameras[cam].negX ? -1 : 1, 1672 negYFac = g_FixedCameras[cam].negY ? -1 : 1;
1676 negYFac = g_FixedCameras[cam].negY ? -1 : 1;
1677 1673
1678 info.v0 = info.v1 = g_origin; 1674 info.v0 = info.v1 = g_origin;
1679 info.v0[x2d] = - (info.ox * info.lw * negXFac) / img->width(); 1675 info.v0[x2d] = - (info.ox * info.lw * negXFac) / img->width();
1680 info.v0[y2d] = (info.oy * info.lh * negYFac) / img->height(); 1676 info.v0[y2d] = (info.oy * info.lh * negYFac) / img->height();
1681 info.v1[x2d] = info.v0[x2d] + info.lw; 1677 info.v1[x2d] = info.v0[x2d] + info.lw;
1899 1895
1900 if (!ovlobj && meta.img) 1896 if (!ovlobj && meta.img)
1901 { delete meta.img; 1897 { delete meta.img;
1902 meta.img = null; 1898 meta.img = null;
1903 } elif (ovlobj && (!meta.img || meta.fname != ovlobj->filename())) 1899 } elif (ovlobj && (!meta.img || meta.fname != ovlobj->filename()))
1904 1900 setupOverlay (cam, ovlobj->filename(), ovlobj->x(), ovlobj->y(), ovlobj->width(), ovlobj->height());
1905 setupOverlay (cam, ovlobj->filename(), ovlobj->x(), ovlobj->y(), ovlobj->width(), ovlobj->height());
1906 } 1901 }
1907 } 1902 }
1908 1903
1909 // ============================================================================= 1904 // =============================================================================
1910 // ----------------------------------------------------------------------------- 1905 // -----------------------------------------------------------------------------
1928 // If the overlay object was there and the overlay itself is 1923 // If the overlay object was there and the overlay itself is
1929 // not, remove the object. 1924 // not, remove the object.
1930 m_file->forgetObject (ovlobj); 1925 m_file->forgetObject (ovlobj);
1931 delete ovlobj; 1926 delete ovlobj;
1932 } elif (meta.img && !ovlobj) 1927 } elif (meta.img && !ovlobj)
1933
1934 { // Inverse case: image is there but the overlay object is 1928 { // Inverse case: image is there but the overlay object is
1935 // not, thus create the object. 1929 // not, thus create the object.
1936 ovlobj = new LDOverlay; 1930 ovlobj = new LDOverlay;
1937 1931
1938 // Find a suitable position to place this object. We want to place 1932 // Find a suitable position to place this object. We want to place

mercurial