Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Jul 30, 2019
1 parent 064874b commit 001df97
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/src/main/cpp/BrowserWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ BrowserWorld::AddWidget(int32_t aHandle, const WidgetPlacementPtr& aPlacement) {
}
float worldWidth = aPlacement->worldWidth;
if (worldWidth <= 0.0f) {
worldWidth = aPlacement->width * WidgetPlacement::WORLD_DPI_RATIO;
worldWidth = aPlacement->width * WidgetPlacement::kWorldDPIRatio;
}

const int32_t textureWidth = aPlacement->GetTextureWidth();
Expand Down Expand Up @@ -1010,9 +1010,9 @@ BrowserWorld::LayoutWidget(int32_t aHandle) {

vrb::Matrix transform = vrb::Matrix::Identity();

vrb::Vector translation = vrb::Vector(aPlacement->translation.x() * WidgetPlacement::WORLD_DPI_RATIO,
aPlacement->translation.y() * WidgetPlacement::WORLD_DPI_RATIO,
aPlacement->translation.z() * WidgetPlacement::WORLD_DPI_RATIO);
vrb::Vector translation = vrb::Vector(aPlacement->translation.x() * WidgetPlacement::kWorldDPIRatio,
aPlacement->translation.y() * WidgetPlacement::kWorldDPIRatio,
aPlacement->translation.z() * WidgetPlacement::kWorldDPIRatio);

const float anchorX = (aPlacement->anchor.x() - 0.5f) * worldWidth;
const float anchorY = (aPlacement->anchor.y() - 0.5f) * worldHeight;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/cpp/WidgetMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct WidgetMover::State {
const float minX = -2.0f;
const float maxY = 2.0f;
const float minY = -1.0f;
float x = initialPlacement->translation.x() * WidgetPlacement::kWorldDPIRatio;
float y = initialPlacement->translation.y() * WidgetPlacement::kWorldDPIRatio;
const float maxAngle = -35.0f * (float)M_PI / 180.0f;
const float angleStartY = 0.8f;
const float minZ = -2.5f;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/WidgetPlacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace crow {

const float WidgetPlacement::WORLD_DPI_RATIO = 2.0f/720.0f;
const float WidgetPlacement::kWorldDPIRatio = 2.0f/720.0f;

WidgetPlacementPtr
WidgetPlacement::FromJava(JNIEnv* aEnv, jobject& aObject) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/cpp/WidgetPlacement.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ struct WidgetPlacement {
int32_t GetTextureWidth() const;
int32_t GetTextureHeight() const;

static const float WORLD_DPI_RATIO;
static const float kWorldDPIRatio;
static WidgetPlacementPtr FromJava(JNIEnv* aEnv, jobject& aObject);
static WidgetPlacementPtr Create(const WidgetPlacement& aPlacement);
private:
WidgetPlacement() = default;
WidgetPlacement(const WidgetPlacement&) = default;
WidgetPlacement& operator=(const WidgetPlacement&) = default;
};

}
Expand Down

0 comments on commit 001df97

Please sign in to comment.