Warning, /plasma/plasma-sdk/themeexplorer/package/contents/ui/delegates/Hand.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com> 0003 * SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org> 0004 * SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 import QtQuick 2.0 0010 0011 import org.kde.ksvg 1.0 as KSvg 0012 0013 KSvg.SvgItem { 0014 id: handRoot 0015 0016 property alias rotation: rotation.angle 0017 property double svgScale 0018 property double horizontalRotationOffset: 0 0019 property double verticalRotationOffset: 0 0020 property string rotationCenterHintId 0021 readonly property double horizontalRotationCenter: { 0022 if (svg.hasElement(rotationCenterHintId)) { 0023 var hintedCenterRect = svg.elementRect(rotationCenterHintId), 0024 handRect = svg.elementRect(elementId), 0025 hintedX = hintedCenterRect.x - handRect.x + hintedCenterRect.width/2; 0026 return Math.round(hintedX * svgScale) + Math.round(hintedX * svgScale) % 2; 0027 } 0028 return width/2; 0029 } 0030 readonly property double verticalRotationCenter: { 0031 if (svg.hasElement(rotationCenterHintId)) { 0032 var hintedCenterRect = svg.elementRect(rotationCenterHintId), 0033 handRect = svg.elementRect(elementId), 0034 hintedY = hintedCenterRect.y - handRect.y + hintedCenterRect.height/2; 0035 return Math.round(hintedY * svgScale) + width % 2; 0036 } 0037 return width/2; 0038 } 0039 0040 width: Math.round(naturalSize.width * svgScale) + Math.round(naturalSize.width * svgScale) % 2 0041 height: Math.round(naturalSize.height * svgScale) + width % 2 0042 anchors { 0043 top: clock.verticalCenter 0044 topMargin: -verticalRotationCenter + verticalRotationOffset 0045 left: clock.horizontalCenter 0046 leftMargin: -horizontalRotationCenter + horizontalRotationOffset 0047 } 0048 0049 svg: clockSvg 0050 transform: Rotation { 0051 id: rotation 0052 angle: 0 0053 origin { 0054 x: handRoot.horizontalRotationCenter 0055 y: handRoot.verticalRotationCenter 0056 } 0057 Behavior on angle { 0058 RotationAnimation { 0059 id: anim 0060 duration: 200 0061 direction: RotationAnimation.Clockwise 0062 easing.type: Easing.OutElastic 0063 easing.overshoot: 0.5 0064 } 0065 } 0066 } 0067 }