ListItem.qml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import QtQuick 2.0
  2. Item {
  3. id: root
  4. width: 256
  5. height: 256
  6. property string name: model.name
  7. property bool isSelected: pathView.currentIndex === model.index
  8. property real fogAmount: PathView.iconFog
  9. z: PathView.iconZ
  10. scale: PathView.iconScale
  11. Image {
  12. id: shadowSource
  13. source: model.shadowIcon
  14. width: nmapItem.width
  15. height: nmapItem.height
  16. anchors.centerIn: nmapItem
  17. anchors.horizontalCenterOffset: ((root.x + root.width/2) - (lightSourceItem.width/2)) * 0.05
  18. anchors.verticalCenterOffset: ((root.y + root.height/2) - (lightSourceItem.height/2)) * 0.05 + (settings.spotAnimationPosition - 25) * (0.8 - fogAmount)
  19. opacity: 0.2 + (fogAmount*0.8)
  20. scale: 1.2 - (fogAmount*0.4)
  21. }
  22. NMapEffect {
  23. id: nmapItem
  24. sourceImage: model.sourceIcon
  25. normalsImage: model.normalsIcon
  26. lightSource: lightSourceItem
  27. switchX: true
  28. switchY: true
  29. elementPositionX: root.x
  30. elementPositionY: root.y
  31. colorizeAmount: fogAmount
  32. diffuseBoost: 0.5
  33. }
  34. MouseArea {
  35. anchors.fill: parent
  36. onClicked: {
  37. if (isSelected) {
  38. // TODO: Open the item
  39. } else {
  40. pathView.currentIndex = model.index;
  41. }
  42. }
  43. }
  44. }