Gui: [skip ci] replace getNormalizedPosition() with normalizePixelPos()

This commit is contained in:
wmayer
2021-11-02 19:06:12 +01:00
parent 1167babc66
commit 5bd156066e
9 changed files with 14 additions and 25 deletions

View File

@@ -88,11 +88,11 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -92,11 +92,11 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -96,11 +96,11 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -1372,16 +1372,6 @@ void NavigationStyle::clearLog(void)
this->log.historysize = 0;
}
SbVec2f NavigationStyle::getNormalizedPosition(const SoEvent * const ev,
const SbViewportRegion & vpRgn) const
{
const SbVec2s size(vpRgn.getViewportSizePixels());
const SbVec2s pos(ev->getPosition());
const SbVec2f posn((float) pos[0] / (float) std::max((int)(size[0] - 1), 1),
(float) pos[1] / (float) std::max((int)(size[1] - 1), 1));
return posn;
}
void NavigationStyle::syncModifierKeys(const SoEvent * const ev)
{
// Mismatches in state of the modifier keys happens if the user

View File

@@ -213,7 +213,6 @@ protected:
void clearLog(void);
void addToLog(const SbVec2s pos, const SbTime time);
SbVec2f getNormalizedPosition(const SoEvent * const ev, const SbViewportRegion & vpRgn) const;
void syncModifierKeys(const SoEvent * const ev);
SbBool handleKeyboardEvent(const SoKeyboardEvent * const event, const SbVec2f & posn);

View File

@@ -88,11 +88,11 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -88,11 +88,11 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -88,11 +88,11 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an

View File

@@ -88,11 +88,11 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
const SoType type(ev->getTypeId());
const SbViewportRegion & vp = viewer->getSoRenderManager()->getViewportRegion();
const SbVec2f posn = getNormalizedPosition(ev, vp);
const SbVec2s pos(ev->getPosition());
const SbVec2f posn = normalizePixelPos(pos);
const SbVec2f prevnormalized = this->lastmouseposition;
this->lastmouseposition = posn;
const SbVec2s pos(ev->getPosition());
// Set to true if any event processing happened. Note that it is not
// necessary to restrict ourselves to only do one "action" for an