View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007746 | Scribus | User Interface | public | 2009-01-22 14:45 | 2015-02-09 02:24 |
Reporter | OssiLehtinen | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | new | Resolution | open | ||
Platform | Linux | OS | Ubuntu | OS Version | 8.10 |
Product Version | 1.3.5svn | ||||
Summary | 0007746: [PATCH] Request+Implementation: Preserve current selection if it is at clicked location | ||||
Description | When one has two items e.g. image frames on the same layer overlapping, and one has the lower level one selected and tries to for example move it, but by grabbing it at a location where the other item on higher level is, the other item gets selected and moved. This seems a tad counterintuitive to me and also makes working at crowded spots pretty difficult. An alternative for this would be, that when one clicks on the canvas a check is made whether the current selected items are at the click location and if so, the old selection is preserved. The attached patch accomplishes this change if you guys want to take a look at it. Please note that I made the modified function return true in this case, but it's not clear to me if this should happen. | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
2009-01-22 14:45
|
preserveSelection.diff (1,094 bytes)
Index: Scribus/scribus/canvasmode_normal.cpp =================================================================== --- Scribus/scribus/canvasmode_normal.cpp (revision 13079) +++ Scribus/scribus/canvasmode_normal.cpp (working copy) @@ -1014,6 +1014,20 @@ const unsigned SELECT_IN_GROUP = Qt::AltModifier; const unsigned SELECT_MULTIPLE = Qt::ShiftModifier; const unsigned SELECT_BENEATH = Qt::ControlModifier; + + /* OssiLehtinen: If we have an active selection and we click in its area, + the current selection will be preserved even though another item is on + a higher level at the click location. */ + bool oldItemUnderCursor = false; + PageItem * tempItem = m_canvas->itemUnderCursor(m->globalPos(), NULL, (m->modifiers() & SELECT_IN_GROUP)); + while(tempItem) + { + if(m_doc->m_Selection->findItem(tempItem) >= 0) oldItemUnderCursor = true; + tempItem = m_canvas->itemUnderCursor(m->globalPos(), tempItem, (m->modifiers() & SELECT_IN_GROUP)); + } + if(oldItemUnderCursor) + return true; + QMatrix p; PageItem *currItem; m_canvas->m_viewMode.m_MouseButtonPressed = true; |
|
This should be restricted to situations when no modifier key is pressed, otherwise some multiple selections will be hard to accomplish. |
|
You're probably right. Do you mean selecting for example items that are completely overlapping and so on? Also I guess if a modifier is pressed, the user is more likely to have the intent of making selections and not e.g. move the current one, although e.g. ctrl-modifier is used to constrict movement to only horizontal movement and so one. This might lead to a feeling of inconsistency... It also might be better to not check if we have an item from current selection at click location, but instead to simply check if the click happened in the area of the current selection. Sometimes (most of the times actually) the selection rectangle is covering other areas apart from the selected items. |
2009-01-22 18:02
|
preserveSelection_2.diff (2,941 bytes)
Index: Scribus/scribus/selection.h =================================================================== --- Scribus/scribus/selection.h (revision 13080) +++ Scribus/scribus/selection.h (working copy) @@ -141,6 +141,10 @@ bool isGUISelection() const { return m_isGUISelection; } double width() const; double height() const; + /* Author: OssiLehtinen + * Returns the coordinates of the rectangle surrounding items in the current selection + */ + void getSelectionRect(double *x, double *y, double *w, double *h); //set the group rectangle properties void setGroupRect(); void getGroupRect(double *x, double *y, double *w, double *h); Index: Scribus/scribus/selection.cpp =================================================================== --- Scribus/scribus/selection.cpp (revision 13080) +++ Scribus/scribus/selection.cpp (working copy) @@ -355,6 +355,37 @@ } return maxY-minY; } + +// Author: OssiLehtinen +void Selection::getSelectionRect(double *x, double *y, double *w, double *h) +{ + if (m_SelList.isEmpty()) + { + *x = 0; *y = 0; *w = 0; *h = 0; + return; + } + double minX=9999999.9; + double minY=9999999.9; + double maxX=-9999999.9; + double maxY=-9999999.9; + SelectionList::ConstIterator it=m_SelList.begin(); + SelectionList::ConstIterator itend=m_SelList.end(); + double x1=0.0,x2=0.0,y1=0.0,y2=0.0; + for ( ; it!=itend ; ++it) + { + (*it)->getBoundingRect(&x1, &y1, &x2, &y2); + if (y1<minY) + minY=y1; + if (y2>maxY) + maxY=y2; + if (x1<minX) + minX=x1; + if (x2>maxX) + maxX=x2; + } + *x = minX; *y = minY; *w = maxX - minX; *h = maxY - minY; + return; +} void Selection::setGroupRect() { Index: Scribus/scribus/canvasmode_normal.cpp =================================================================== --- Scribus/scribus/canvasmode_normal.cpp (revision 13080) +++ Scribus/scribus/canvasmode_normal.cpp (working copy) @@ -1024,6 +1024,15 @@ int MypS = static_cast<int>(mousePointDoc.y()); //m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y()); QRectF mpo(m_mouseCurrentPoint.x()-grabRadius, m_mouseCurrentPoint.y()-grabRadius, grabRadius*2, grabRadius*2); // mpo.translate(m_doc->minCanvasCoordinate.x() * m_canvas->scale(), m_doc->minCanvasCoordinate.y() * m_canvas->scale()); + + /* OssiLehtinen: If we have an active selection and we click in its area, + the current selection will be preserved even though another item is on + a higher level at the click location. This does not apply if modifiers are pressed.*/ + double x, y, w, h; + m_doc->m_Selection->getSelectionRect(&x, &y, &w, &h); + if(MxpS > (int)x && MxpS < (int)x + (int)w && MypS > (int)y && MypS < (int)y + (int)h && (m->modifiers() & SELECT_IN_GROUP) == 0 && (m->modifiers() & SELECT_MULTIPLE) == 0 && (m->modifiers() & SELECT_BENEATH) == 0 ) + return true; + m_doc->nodeEdit.deselect(); if(!m_doc->guidesSettings.before) // guides are on foreground and want to be processed first |
|
The new diff includes modifier check. Also it looks at the bounding rectangle of the whole selection instead of individual objects. |
|
To emphasize BAlpha's point: The check for modifiers is absolutely necessary, becouse otherwise the modified actions are essentially broken. With shift on cannot unselect members from a group and selecting beneath things with ctrl doesn't work at all. Otherwise this seems to make things work 'as expected'. It also makes the select beneath thing more useful as one can select something beneath other things and still move it with a simple drag gesture. Still, I understand that this all is to some extent a matter of taste. |
|
This propsition probably has been buried long time ago, but still I want to ask if there's any chance of seeing something like this in the official version? I'm keeping my patch up to date with the latest svn version, but would be nice to know whether I need to keep doing it for ever :) Still I'd like to remark, that this makes working with overlapping layers closer to a pleasure (at least for me :)). |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-01-22 14:45 | OssiLehtinen | New Issue | |
2009-01-22 14:45 | OssiLehtinen | File Added: preserveSelection.diff | |
2009-01-22 14:55 | BAlpha | Note Added: 0020967 | |
2009-01-22 15:29 | OssiLehtinen | Note Added: 0020968 | |
2009-01-22 16:05 | OssiLehtinen | Note Edited: 0020968 | |
2009-01-22 18:02 | OssiLehtinen | File Added: preserveSelection_2.diff | |
2009-01-22 18:03 | OssiLehtinen | Note Added: 0020971 | |
2009-01-23 09:40 | OssiLehtinen | Note Added: 0020975 | |
2009-01-23 11:49 | OssiLehtinen | Note Edited: 0020975 | |
2009-04-21 10:04 | OssiLehtinen | Note Added: 0021584 | |
2015-02-09 02:23 | Kunda | Patch | => Yes |
2015-02-09 02:23 | Kunda | Summary | Request+Implementation: Preserve current selection if it is at clicked location => [PATCH} Request+Implementation: Preserve current selection if it is at clicked location |
2015-02-09 02:24 | Kunda | Summary | [PATCH} Request+Implementation: Preserve current selection if it is at clicked location => [PATCH] Request+Implementation: Preserve current selection if it is at clicked location |