/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
Window window = mApplication.GetWindow();
window.KeyEventSignal().Connect(this, &BezierCurveExample::OnKeyEvent);
+ const Vector2 windowSize = window.GetSize();
+ const bool orientationPortrait = windowSize.width < windowSize.height;
+
+ unsigned int tableViewRows = 5;
+ unsigned int tableViewColumns = 1;
+ unsigned int rowPositionAdder = 1;
+ TableView::CellPosition gridPosition{1,0};
+
+ // Change layout if we're in landscape mode
+ if(!orientationPortrait)
+ {
+ tableViewRows = 4;
+ tableViewColumns = 2;
+ rowPositionAdder = 0;
+ gridPosition = {0,1,4,1};
+ }
CreateBackground(window);
mContentLayer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
window.Add(mContentLayer);
- // 6 rows: title, grid, coords, play, anim1, anim2
- TableView contentLayout = TableView::New(5, 1);
+ TableView contentLayout = TableView::New(tableViewRows, tableViewColumns);
contentLayout.SetProperty(Dali::Actor::Property::NAME, "contentLayout");
contentLayout.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
contentLayout.SetCellPadding(Size(30, 30));
mGrid.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mGrid.SetBackgroundColor(GRID_BACKGROUND_COLOR);
- contentLayout.Add(mGrid);
+ contentLayout.AddChild(mGrid, gridPosition);
contentLayout.SetCellAlignment(1, HorizontalAlignment::CENTER, VerticalAlignment::CENTER);
CreateCubic(mGrid);
CreateControlPoints(mGrid); // Control points constrained to double height of grid
contentLayout.Add(mCoefficientLabel);
SetLabel(Vector2(0, 0), Vector2(1, 1));
- contentLayout.SetCellAlignment(2, HorizontalAlignment::CENTER, VerticalAlignment::CENTER);
+ contentLayout.SetCellAlignment(1 + rowPositionAdder, HorizontalAlignment::CENTER, VerticalAlignment::CENTER);
contentLayout.SetFitHeight(2);
// Setup Play button and 2 icons to show off current anim and linear anim
play.ClickedSignal().Connect(this, &BezierCurveExample::OnPlayClicked);
contentLayout.Add(play);
- contentLayout.SetCellAlignment(3, HorizontalAlignment::CENTER, VerticalAlignment::CENTER);
- contentLayout.SetFitHeight(3);
+ contentLayout.SetCellAlignment(2 + rowPositionAdder, HorizontalAlignment::CENTER, VerticalAlignment::CENTER);
+ contentLayout.SetFitHeight(2 + rowPositionAdder);
auto animContainer = Control::New();
animContainer.SetProperty(Dali::Actor::Property::NAME, "AnimationContainer");
animContainer.Add(animRail);
contentLayout.Add(animContainer);
- contentLayout.SetFixedHeight(4, 150);
+ contentLayout.SetFixedHeight(3 + rowPositionAdder, 150);
mAnimIcon1 = ImageView::New(CIRCLE1_IMAGE);
mAnimIcon1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
auto window = application.GetWindow();
window.SetBackgroundColor(Color::WHITE);
+ const auto windowHeight = window.GetSize().GetHeight();
mDragAndDropDetector = Dali::Toolkit::DragAndDropDetector::New();
window.KeyEventSignal().Connect(this, &DragAndDropExample::OnKeyEvent);
TextLabel hintText = TextLabel::New("please drag one textlabel, move and drop on other textlabel");
- hintText.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 700.0f));
- hintText.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
- hintText.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ hintText.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
+ hintText.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
hintText.SetProperty(TextLabel::Property::MULTI_LINE, true);
window.Add(hintText);
for(unsigned int i = 0; i < TEXT_LABEL_NUM; i++)
{
+ // Should be able to fit this and another more so if the height is less, then just stop adding new text labels
+ if((TEXT_LABEL_POSITION_START_Y + TEXT_LABEL_HEIGHT * (i + 2)) >= windowHeight)
+ {
+ break;
+ }
+
std::string str = "textlabel ";
mTextLabel[i] = TextLabel::New(str + std::to_string(i));
mTextLabel[i].SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Get a handle to the window
Window window = application.GetWindow();
window.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
+ const Vector2 windowSize = window.GetSize();
+ const bool portraitOrientation = windowSize.width < windowSize.height;
+ const Property::Index positionProperty = portraitOrientation ? Actor::Property::POSITION_Y : Actor::Property::POSITION_X;
auto green0 = Vector4(0.f, 1.f, 0.f, 0.25f);
auto green1 = Vector4(0.f, 0.25f, 0.f, 0.25f);
Toolkit::ImageView imageView0 = CreateImageView(IMAGE_PATH);
imageView0.SetProperty(Actor::Property::SIZE, Vector2(imageSize, imageSize));
imageView0.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- imageView0.SetProperty(Actor::Property::POSITION_Y, -imageSize * 0.5f);
+ imageView0.SetProperty(positionProperty, -imageSize * 0.5f);
window.Add(imageView0);
Toolkit::ImageView imageView1 = CreateImageView(redGreen0);
imageView1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
Toolkit::ImageView imageView2 = CreateImageView(IMAGE_PATH);
imageView2.SetProperty(Actor::Property::SIZE, Vector2(imageSize, imageSize));
imageView2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- imageView2.SetProperty(Actor::Property::POSITION_Y, imageSize * 0.5f);
+ imageView2.SetProperty(positionProperty, imageSize * 0.5f);
window.Add(imageView2);
Toolkit::ImageView imageView3 = CreateImageView(redGreen1);
imageView3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void CreateActor()
{
Window window = mApplication.GetWindow();
+ const auto windowSize = window.GetSize();
- float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
- mActor = Actor::New();
+ const float quarterWindowSize = std::min(windowSize.GetWidth(), windowSize.GetHeight()) * 0.25f;
+ mActor = Actor::New();
mActor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 1.0f, 0.6f, 1.0f));
mActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowWidth, quarterWindowWidth, quarterWindowWidth));
+ mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowSize, quarterWindowSize, quarterWindowSize));
mActor.AddRenderer(mRenderer);
window.Add(mActor);
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void CreateActor()
{
Window window = mApplication.GetWindow();
+ const auto windowSize = window.GetSize();
- float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
- mActor = Actor::New();
+ float quarterWindowSize = std::min(windowSize.GetWidth(), windowSize.GetHeight()) * 0.25f;
+ mActor = Actor::New();
mActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
mActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowWidth, quarterWindowWidth, quarterWindowWidth));
+ mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowSize, quarterWindowSize, quarterWindowSize));
mActor.AddRenderer(mRenderer);
window.Add(mActor);
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void CreateActor()
{
Window window = mApplication.GetWindow();
+ const auto windowSize = window.GetSize();
- float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
- mActor = Actor::New();
+ float quarterWindowSize = std::min(windowSize.GetWidth(), windowSize.GetHeight()) * 0.25f;
+ mActor = Actor::New();
mActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
mActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowWidth, quarterWindowWidth, quarterWindowWidth));
+ mActor.SetProperty(Actor::Property::SIZE, Vector3(quarterWindowSize, quarterWindowSize, quarterWindowSize));
mActor.AddRenderer(mRenderer);
window.Add(mActor);
}
mContainer = Control::New();
mContainer.SetProperty(Dali::Actor::Property::NAME, "Container");
mContainer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- mLayoutSize = Vector2(mWindowSize.width * 0.6f, mWindowSize.width * 0.6f);
+ auto size = std::min(mWindowSize.width, mWindowSize.height) * 0.6f;
+ mLayoutSize = Vector2(size, size);
mContainer.SetProperty(Actor::Property::SIZE, mLayoutSize);
window.Add(mContainer);