Merge branch 'master' of https://github.com/highfidelity/hifi into keylightInheritance

This commit is contained in:
Nissim Hadar 2018-01-09 10:10:27 -08:00
commit e94982a470
2 changed files with 28 additions and 3 deletions

View file

@ -127,9 +127,15 @@ Item {
GridView { GridView {
id: gridView id: gridView
keyNavigationEnabled: false keyNavigationEnabled: false
highlightFollowsCurrentItem: false highlightFollowsCurrentItem: false
property int previousGridIndex: -1 property int previousGridIndex: -1
// true if any of the buttons contains mouse
property bool containsMouse: false
anchors { anchors {
fill: parent fill: parent
topMargin: 20 topMargin: 20
@ -162,15 +168,29 @@ Item {
flow: GridView.LeftToRight flow: GridView.LeftToRight
model: page.proxyModel model: page.proxyModel
delegate: Item { delegate: Control {
id: wrapper id: wrapper
width: gridView.cellWidth width: gridView.cellWidth
height: gridView.cellHeight height: gridView.cellHeight
hoverEnabled: true
property bool containsMouse: gridView.containsMouse
onHoveredChanged: {
if (hovered && !gridView.containsMouse) {
gridView.containsMouse = true
} else {
gridView.containsMouse = false
}
}
property var proxy: modelData property var proxy: modelData
TabletButton { TabletButton {
id: tabletButton id: tabletButton
scale: wrapper.hovered ? 1.25 : wrapper.containsMouse ? 0.75 : 1.0
Behavior on scale { NumberAnimation { duration: 200; easing.type: Easing.Linear } }
anchors.centerIn: parent anchors.centerIn: parent
gridView: wrapper.GridView.view gridView: wrapper.GridView.view
buttonIndex: page.proxyModel.buttonIndex(uuid); buttonIndex: page.proxyModel.buttonIndex(uuid);

View file

@ -225,7 +225,7 @@ function adjustPositionPerBoundingBox(position, direction, registration, dimensi
var TOOLS_PATH = Script.resolvePath("assets/images/tools/"); var TOOLS_PATH = Script.resolvePath("assets/images/tools/");
var GRABBABLE_ENTITIES_MENU_CATEGORY = "Edit"; var GRABBABLE_ENTITIES_MENU_CATEGORY = "Edit";
var GRABBABLE_ENTITIES_MENU_ITEM = "Create Entities As Grabbable"; var GRABBABLE_ENTITIES_MENU_ITEM = "Create Entities As Grabbable (except Zones, Particles, and Lights)";
var toolBar = (function () { var toolBar = (function () {
var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts
@ -239,6 +239,7 @@ var toolBar = (function () {
var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS; var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS;
var position = getPositionToCreateEntity(); var position = getPositionToCreateEntity();
var entityID = null; var entityID = null;
if (position !== null && position !== undefined) { if (position !== null && position !== undefined) {
var direction; var direction;
if (Camera.mode === "entity" || Camera.mode === "independent") { if (Camera.mode === "entity" || Camera.mode === "independent") {
@ -278,9 +279,13 @@ var toolBar = (function () {
position = grid.snapToSurface(grid.snapToGrid(position, false, dimensions), dimensions); position = grid.snapToSurface(grid.snapToGrid(position, false, dimensions), dimensions);
properties.position = position; properties.position = position;
if (Menu.isOptionChecked(GRABBABLE_ENTITIES_MENU_ITEM)) { if (Menu.isOptionChecked(GRABBABLE_ENTITIES_MENU_ITEM) &&
!(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect")) {
properties.userData = JSON.stringify({ grabbableKey: { grabbable: true } }); properties.userData = JSON.stringify({ grabbableKey: { grabbable: true } });
} else {
properties.userData = JSON.stringify({ grabbableKey: { grabbable: false } });
} }
entityID = Entities.addEntity(properties); entityID = Entities.addEntity(properties);
if (properties.type === "ParticleEffect") { if (properties.type === "ParticleEffect") {