Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
35000fe7
Commit
35000fe7
authored
Mar 09, 2016
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added preview circle around highlighter tool
parent
a8f2ef66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
9 deletions
+73
-9
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+3
-3
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+63
-4
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+7
-2
No files found.
src/board/UBBoardPaletteManager.cpp
View file @
35000fe7
...
...
@@ -540,7 +540,7 @@ void UBBoardPaletteManager::activeSceneChanged()
int
pageIndex
=
UBApplication
::
boardController
->
activeSceneIndex
();
if
(
mStylusPalette
)
connect
(
mStylusPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Eraser
()));
connect
(
mStylusPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Tool
()));
if
(
mpPageNavigWidget
)
{
...
...
@@ -548,10 +548,10 @@ void UBBoardPaletteManager::activeSceneChanged()
}
if
(
mZoomPalette
)
connect
(
mZoomPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Eraser
()));
connect
(
mZoomPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Tool
()));
if
(
mBackgroundsPalette
)
connect
(
mBackgroundsPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Eraser
()));
connect
(
mBackgroundsPalette
,
SIGNAL
(
mouseEntered
()),
activeScene
,
SLOT
(
hide
Tool
()));
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
35000fe7
...
...
@@ -314,6 +314,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
:
UBCoreGraphicsScene
(
parent
)
,
mEraser
(
0
)
,
mPointer
(
0
)
,
mMarkerCircle
(
0
)
,
mDocument
(
parent
)
,
mDarkBackground
(
false
)
,
mCrossedBackground
(
false
)
...
...
@@ -341,6 +342,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
setDocument
(
parent
);
createEraiser
();
createPointer
();
createMarkerCircle
();
if
(
UBApplication
::
applicationController
)
{
...
...
@@ -399,6 +401,10 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
mCurrentStroke
=
NULL
;
}
// hide the marker preview circle
if
(
currentTool
==
UBStylusTool
::
Marker
)
hideMarkerCircle
();
// ---------------------------------------------------------------
// Create a new Stroke. A Stroke is a collection of QGraphicsLines
// ---------------------------------------------------------------
...
...
@@ -470,6 +476,15 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
accepted
=
true
;
}
else
if
(
currentTool
==
UBStylusTool
::
Marker
)
{
if
(
mInputDeviceIsPressed
)
hideMarkerCircle
();
else
{
drawMarkerCircle
(
position
);
accepted
=
true
;
}
}
if
(
mInputDeviceIsPressed
)
{
if
(
dc
->
isDrawingTool
())
...
...
@@ -670,6 +685,12 @@ void UBGraphicsScene::redrawEraser(bool pressed)
}
}
void
UBGraphicsScene
::
hideEraser
()
{
if
(
mEraser
)
mEraser
->
hide
();
}
void
UBGraphicsScene
::
drawPointer
(
const
QPointF
&
pPoint
,
bool
isFirstDraw
)
{
qreal
pointerDiameter
=
UBSettings
::
pointerDiameter
/
UBApplication
::
boardController
->
currentZoom
();
...
...
@@ -687,6 +708,28 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw)
}
}
void
UBGraphicsScene
::
drawMarkerCircle
(
const
QPointF
&
pPoint
)
{
if
(
mMarkerCircle
)
{
qreal
markerDiameter
=
UBSettings
::
settings
()
->
currentMarkerWidth
();
markerDiameter
/=
UBApplication
::
boardController
->
systemScaleFactor
();
markerDiameter
/=
UBApplication
::
boardController
->
currentZoom
();
qreal
markerRadius
=
markerDiameter
/
2
;
mMarkerCircle
->
setRect
(
QRectF
(
pPoint
.
x
()
-
markerRadius
,
pPoint
.
y
()
-
markerRadius
,
markerDiameter
,
markerDiameter
));
mMarkerCircle
->
show
();
}
}
void
UBGraphicsScene
::
hideMarkerCircle
()
{
if
(
mMarkerCircle
)
{
mMarkerCircle
->
hide
();
}
}
// call this function when user release mouse button in Magnifier mode
void
UBGraphicsScene
::
DisposeMagnifierQWidgets
()
{
...
...
@@ -1105,16 +1148,16 @@ UBGraphicsPolygonItem* UBGraphicsScene::polygonToPolygonItem(const QPolygonF pPo
return
polygonItem
;
}
void
UBGraphicsScene
::
hide
Eraser
()
void
UBGraphicsScene
::
hide
Tool
()
{
if
(
mEraser
)
mEraser
->
hid
e
();
hideEraser
();
hideMarkerCircl
e
();
}
void
UBGraphicsScene
::
leaveEvent
(
QEvent
*
event
)
{
Q_UNUSED
(
event
);
hide
Eraser
();
hide
Tool
();
}
UBGraphicsScene
*
UBGraphicsScene
::
sceneDeepCopy
()
const
...
...
@@ -2514,6 +2557,22 @@ void UBGraphicsScene::createPointer()
addItem
(
mPointer
);
}
void
UBGraphicsScene
::
createMarkerCircle
()
{
mMarkerCircle
=
new
QGraphicsEllipseItem
();
mMarkerCircle
->
setRect
(
QRect
(
0
,
0
,
0
,
0
));
mMarkerCircle
->
setVisible
(
false
);
mMarkerCircle
->
setPen
(
Qt
::
DotLine
);
// TODO: set line color to black on white, or white on black
mMarkerCircle
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
mMarkerCircle
->
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
Eraiser
));
mTools
<<
mMarkerCircle
;
addItem
(
mMarkerCircle
);
}
void
UBGraphicsScene
::
setToolCursor
(
int
tool
)
{
if
(
tool
==
(
int
)
UBStylusTool
::
Selector
||
...
...
src/domain/UBGraphicsScene.h
View file @
35000fe7
...
...
@@ -323,7 +323,7 @@ public slots:
void
updateSelectionFrame
();
void
updateSelectionFrameWrapper
(
int
);
void
initStroke
();
void
hide
Eraser
();
void
hide
Tool
();
void
setBackground
(
bool
pIsDark
,
bool
pIsCrossed
);
void
setBackgroundZoomFactor
(
qreal
zoom
);
...
...
@@ -361,7 +361,10 @@ public slots:
void
drawEraser
(
const
QPointF
&
pEndPoint
,
bool
pressed
=
true
);
void
redrawEraser
(
bool
pressed
);
void
hideEraser
();
void
drawPointer
(
const
QPointF
&
pEndPoint
,
bool
isFirstDraw
=
false
);
void
drawMarkerCircle
(
const
QPointF
&
pEndPoint
);
void
hideMarkerCircle
();
void
DisposeMagnifierQWidgets
();
...
...
@@ -381,10 +384,12 @@ public slots:
void
setDocumentUpdated
();
void
createEraiser
();
void
createPointer
();
void
createMarkerCircle
();
bool
hasTextItemWithFocus
(
UBGraphicsGroupContainerItem
*
item
);
QGraphicsEllipseItem
*
mEraser
;
QGraphicsEllipseItem
*
mPointer
;
QGraphicsEllipseItem
*
mPointer
;
// "laser" pointer
QGraphicsEllipseItem
*
mMarkerCircle
;
// dotted circle around marker
QSet
<
QGraphicsItem
*>
mAddedItems
;
QSet
<
QGraphicsItem
*>
mRemovedItems
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment