Added view rotation for each click

CURA-4527
This commit is contained in:
Aleksei S 2017-11-03 15:29:33 +01:00
parent 74a7f02166
commit fb8bde6f76
2 changed files with 186 additions and 0 deletions

View file

@ -403,6 +403,89 @@ UM.MainWindow
}
}
//View orientation Item
Item
{
height: 90
width: 90
anchors.top: topbar.bottom;
anchors.topMargin: - UM.Theme.getSize("default_margin").height * 2;
anchors.right: sidebar.left
anchors.rightMargin: 250
//Rotate_top
Button
{
id: orientation_rotate_top;
iconSource: UM.Theme.getIcon("arrow_top")
style: UM.Theme.styles.orientation_button
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 30
}
//Rotate_right
Button
{
id: orientation_rotate_right;
iconSource: UM.Theme.getIcon("arrow_right")
style: UM.Theme.styles.orientation_button
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
anchors.right: parent.right
onClicked:{
UM.Controller.rotateView("x", -90);
}
}
//Rotate_bottom
Button
{
id: orientation_rotate_bottom;
iconSource: UM.Theme.getIcon("arrow_bottom")
style: UM.Theme.styles.orientation_button
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.leftMargin: 30
}
//Rotate_left
Button
{
id: orientation_rotate_left;
iconSource: UM.Theme.getIcon("arrow_left")
style: UM.Theme.styles.orientation_button
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
anchors.left: parent.left
onClicked:{
UM.Controller.rotateView("x", 90);
}
}
//Rotate_front
Button
{
id: orientation_rotate_front;
iconSource: UM.Theme.getIcon("category_machine")
style: UM.Theme.styles.orientation_button
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
anchors.left: parent.left
anchors.leftMargin: 30
onClicked:{
UM.Controller.rotateView("home" , 0);
}
}
}
Loader
{
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null

View file

@ -380,6 +380,109 @@ QtObject {
}
}
property Component orientation_button: Component {
ButtonStyle {
background: Item {
implicitWidth: 30;
implicitHeight: 30;
Rectangle {
id: buttonFace2;
anchors.fill: parent;
property bool down: control.pressed || (control.checkable && control.checked);
color: {
if(control.customColor !== undefined && control.customColor !== null) {
return control.customColor
} else if(control.checkable && control.checked && control.hovered) {
return Theme.getColor("button_active_hover");
} else if(control.pressed || (control.checkable && control.checked)) {
return Theme.getColor("button_active");
} else if(control.hovered) {
return Theme.getColor("button_hover");
} else {
//return Theme.getColor("button");
return "red"
}
}
Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border")
UM.RecolorImage {
id: tool_button_arrow2
//anchors.right: parent.right;
//anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4
//anchors.bottom: parent.bottom;
//anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4
//width: Theme.getSize("standard_arrow").width
//height: Theme.getSize("standard_arrow").height
width: 5
height: 5
sourceSize.width: 5
sourceSize.height: 5
visible: control.menu != null;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("button_text_hover");
}
else
{
return Theme.getColor("button_text");
}
}
source: Theme.getIcon("arrow_bottom")
}
}
}
label: Item {
UM.RecolorImage {
anchors.centerIn: parent;
opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource;
width: 20;
height: 20;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("button_text_hover");
}
else
{
return Theme.getColor("button_text");
}
}
sourceSize: Theme.getSize("button_icon")
}
}
}
}
property Component progressbar: Component{
ProgressBarStyle {
background: Rectangle {