Terminal size and texture sizes are now comparable. Fixed formula for coordinates conversion: mouse input is now pixel perfect.

This commit is contained in:
Filippo Scognamiglio
2014-09-14 02:43:48 +02:00
parent 2dbe129857
commit 1be7987abe
2 changed files with 14 additions and 11 deletions

View File

@@ -26,6 +26,18 @@ import org.crt.konsole 0.1
Item{
id: terminalContainer
//Frame displacement properties. This makes the terminal the same size of the texture.
property real dtop: frame.item.displacementTop
property real dleft:frame.item.displacementLeft
property real dright: frame.item.displacementRight
property real dbottom: frame.item.displacementBottom
anchors.leftMargin: dleft
anchors.rightMargin: dright
anchors.topMargin: dtop
anchors.bottomMargin: dbottom
property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
property variant bloomSource: bloomSourceLoader.item
property variant rasterizationSource: rasterizationEffectSource
@@ -142,19 +154,10 @@ Item{
kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers);
}
//Frame displacement properties
property real dtop: frame.item.displacementTop
property real dleft:frame.item.displacementLeft
property real dright: frame.item.displacementRight
property real dbottom: frame.item.displacementBottom
function correctDistortion(x, y){
x = x / width;
y = y / height;
x = (-dleft + x * (width + dleft + dright)) / width
y = (-dtop + y * (height + dtop + dbottom)) / height
var cc = Qt.size(0.5 - x, 0.5 - y);
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;