fix lineargradientfx handles (#2891)

This commit is contained in:
shun-iwasawa 2019-11-22 00:15:47 +09:00 committed by Jeremy Bullock
parent 1d386c0025
commit ca556f8550
2 changed files with 3 additions and 4 deletions

View file

@ -1510,8 +1510,9 @@ void LinearRangeFxGadget::leftButtonDrag(const TPointD &pos,
if (m_targetPos != m_anotherPos && e.isShiftPressed()) { if (m_targetPos != m_anotherPos && e.isShiftPressed()) {
TPointD vecA = m_targetPos - m_anotherPos; TPointD vecA = m_targetPos - m_anotherPos;
TPointD vecB = m_targetPos + d - m_anotherPos; TPointD vecB = m_targetPos + d - m_anotherPos;
double ratio = std::min(vecB.x / vecA.x, vecB.y / vecA.y); d = vecA * ((vecA.x * vecB.x + vecA.y * vecB.y) /
d = vecA * (ratio - 1.0); (vecA.x * vecA.x + vecA.y * vecA.y) -
1.0);
} }
setValue(target, m_targetPos + d); setValue(target, m_targetPos + d);

View file

@ -183,7 +183,6 @@ void ColumnFan::loadData(TIStream &is) {
void ColumnFan::rollLeftFoldedState(int index, int count) { void ColumnFan::rollLeftFoldedState(int index, int count) {
assert(index >= 0); assert(index >= 0);
assert(count > 1);
int columnCount = m_columns.size(); int columnCount = m_columns.size();
if (columnCount <= index) return; if (columnCount <= index) return;
if (index + count - 1 > columnCount) count = columnCount - index + 1; if (index + count - 1 > columnCount) count = columnCount - index + 1;
@ -210,7 +209,6 @@ void ColumnFan::rollLeftFoldedState(int index, int count) {
void ColumnFan::rollRightFoldedState(int index, int count) { void ColumnFan::rollRightFoldedState(int index, int count) {
assert(index >= 0); assert(index >= 0);
assert(count > 1);
int columnCount = m_columns.size(); int columnCount = m_columns.size();
if (columnCount <= index) return; if (columnCount <= index) return;