diff --git a/src/activities/family/Family.qml b/src/activities/family/Family.qml index 512f49ecd..728aa3edc 100644 --- a/src/activities/family/Family.qml +++ b/src/activities/family/Family.qml @@ -1,302 +1,279 @@ /* GCompris - family.qml * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * * RAJDEEP KAUR * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.1 import GCompris 1.0 import QtGraphicalEffects 1.0 import "../../core" import "family.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Image { id: background anchors.fill: parent source: Activity.url + "back.svg" sourceSize.width: parent.width fillMode: Image.PreserveAspectCrop property bool horizontalLayout: background.width > background.height signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus property alias nodeCreator: nodeCreator property alias answersChoice: answersChoice property alias edgeCreator: edgeCreator - property alias weddingringcreator: weddingringcreator + property alias wringcreator: wringcreator } onStart: { Activity.start(items) } onStop: { Activity.stop() } Item { id: partition width: background.width height: background.height Rectangle { id: tree color: "transparent" width: background.horizontalLayout ? background.width*0.65 : background.width height: background.horizontalLayout ? background.height : background.height*0.65 border.color: "black" border.width: 5 Item { id: treeItem Repeater { id: nodeCreator model: ListModel{} delegate: Tree { id: currentPointer x: xx*tree.width y: yy*tree.height width: tree.width/5 height: tree.width/5 recwidth: currentPointer.width recheight: currentPointer.height searchitem: 3 nodeimagesource: Activity.url+nodee bordercolor: "black" borderwidth: 4 colorr: "transparent" radius: recwidth/2 state: currentstate states: [ - State { - name: "active" - PropertyChanges { - target: currentPointer - bordercolor: "blue" - } - }, - State { - name: "deactive" - PropertyChanges { - target: currentPointer - } - }, - State { + State { + name: "active" + PropertyChanges { + target: currentPointer + bordercolor: "blue" + } + }, + State { + name: "deactive" + PropertyChanges { + target: currentPointer + } + }, + State { name: "activeto" PropertyChanges { target: currentPointer bordercolor: "red" } - } + } ] SequentialAnimation { id: anim running: currentPointer.state === "active" || currentPointer.state === "activeto" loops: Animation.Infinite alwaysRunToEnd: true NumberAnimation { target: currentPointer property: "rotation" from: 0; to: 10 duration: 200 easing.type: Easing.OutQuad } NumberAnimation { target: currentPointer property: "rotation" from: 10; to: -10 duration: 400 easing.type: Easing.InOutQuad } NumberAnimation { target: currentPointer property: "rotation" from: -10; to: 0 duration: 200 easing.type: Easing.InQuad } } } } - GCText { + GCText { id: me text: qsTr("Me") visible: Activity.treeStructure[bar.level-1].captions[0] !== undefined x: Activity.treeStructure[bar.level-1].captions[0][0]*tree.width y: Activity.treeStructure[bar.level-1].captions[0][1]*tree.height width: tree.width/12 height: tree.height/14 } Image { id: questionmark source: Activity.url + "questionmark.svg" visible: Activity.treeStructure[bar.level-1].captions[1] !== undefined x: Activity.treeStructure[bar.level-1].captions[1][0]*tree.width y: Activity.treeStructure[bar.level-1].captions[1][1]*tree.height } Repeater { id: edgeCreator model: ListModel {} delegate: Rectangle { id: edge opacity: 1 antialiasing: true - state: edgeState transformOrigin: Item.TopLeft x: x1*tree.width y: y1*tree.height property var x2: x22*tree.width property var y2: y22*tree.height width: Math.sqrt(Math.pow(x - x2, 2) + Math.pow(y- y2, 2)) height: 4 * ApplicationInfo.ratio rotation: (Math.atan((y2 - y)/(x2-x)) * 180 / Math.PI) + (((y2-y) < 0 && (x2-x) < 0) * 180) + (((y2-y) >= 0 && (x2-x) < 0) * 180) - + color: "black" Behavior on height { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } Behavior on width { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } - states:[ - State { - name: "married" - PropertyChanges { - target: edge - color: "#F1C40F" - } - }, - State { - name: "siblings" - PropertyChanges { - target:edge - color:"#28B463" - } - }, - State { - name: "others" - PropertyChanges { - target: edge - color:"black" - } - } - ] + } } Repeater { - id: weddingringcreator - model: ListModel {} + id: wringcreator + model: ListModel{} delegate: Image { - id: weddingring + id: wring + source: Activity.url + "rings.svg" width: tree.width*0.04 height: tree.width*0.04 x:ringx*tree.width y:ringy*tree.height - source: Activity.url + "weddingrings.svg" } } } } Rectangle { id: answers color: "transparent" width: background.horizontalLayout ? background.width*0.35 : background.width height: background.horizontalLayout ? background.height : background.height*0.35 anchors.left: background.horizontalLayout ? tree.right : partition.left anchors.top: background.horizontalLayout ? partition.top: tree.bottom border.color: "black" border.width: 5 Image { width: parent.width * 0.99 height: parent.height * 0.99 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter source: Activity.url + "answerarea.svg" Grid { columns: 1 rowSpacing: 20 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter Repeater { id: answersChoice model: ListModel {} delegate: AnswerButton { - id: options - width: answers.width*0.70 - height: answers.height*Activity.answerButtonRatio - textLabel: optionn - isCorrectAnswer: textLabel === answer - onCorrectlyPressed: bonus.good("lion") + id: options + width: answers.width*0.70 + height: answers.height*Activity.answerButtonRatio + textLabel: optionn + isCorrectAnswer: textLabel === answer + onCorrectlyPressed: bonus.good("lion") } } } } } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/family/family.js b/src/activities/family/family.js index 596b96163..d37496ec2 100644 --- a/src/activities/family/family.js +++ b/src/activities/family/family.js @@ -1,634 +1,527 @@ /* GCompris - family.js * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * RAJDEEP KAUR * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ .pragma library .import QtQuick 2.0 as Quick var currentLevel = 0 var items var url = "qrc:/gcompris/src/activities/family/resource/" var treeStructure = [ // level 1 { edgeList: [ - [0.41, 0.25, 0.51, 0.25], - [0.55, 0.25, 0.64, 0.25], - [0.53, 0.285, 0.53, 0.50] + [0.41, 0.25, 0.64, 0.25], + [0.53, 0.25, 0.53, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.40, 0.50] ], rationn: [80, 80, 80], - captions: [ - [0.28, 0.60], - [0.101, 0.25] - ], - weddingringpositions:[ - [0.51,0.24] - ], + captions: [ [0.28, 0.60], + [0.101, 0.25] + ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], currentstate: ["activeto", "deactive", "active"], - edgeState:["others","others","others"], + edgeState:["married","others"], answer: [qsTr("Father")], optionss: [qsTr("Father"), qsTr("Grandfather"), qsTr("Uncle")] }, // level 2 - { edgeList: [ - [0.41, 0.25, 0.51, 0.25], - [0.55, 0.25, 0.64, 0.25], - [0.53, 0.285, 0.53, 0.50] - ], - nodePositions: [ + { edgeList: [ + [0.41, 0.25, 0.64, 0.25], + [0.53, 0.25, 0.53, 0.50] + ], + nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.4, 0.50] - ], - rationn: [80, 80, 80], - captions: [ - [0.28, 0.60], + ], + rationn: [80, 80, 80], + captions: [ [0.28, 0.60], [0.8283, 0.24] - ], - weddingringpositions: [ - [0.51,0.24] - ], - nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], - currentstate: ["deactive", "activeto", "active"], - edgeState:["others","others","others"], - answer: [qsTr("Mother")], - optionss: [qsTr("Mother"), qsTr("Grandmother"), qsTr("Aunt")] + ], + nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], + currentstate: ["deactive", "activeto", "active"], + edgeState:["married","others"], + answer: [qsTr("Mother")], + optionss: [qsTr("Mother"), qsTr("Grandmother"), qsTr("Aunt")] }, // level 3 - { edgeList: [ - [0.41, 0.25, 0.51, 0.25], - [0.55, 0.25, 0.64, 0.25], - [0.53, 0.28, 0.44, 0.50], - [0.53, 0.28, 0.63, 0.50] - ], + { edgeList: [ [0.41, 0.25, 0.64, 0.25], + [0.53, 0.257, 0.44, 0.50], + [0.53, 0.257, 0.63, 0.50] + ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.33, 0.50], [0.55, 0.50] ], rationn: [80, 80, 80], - captions:[ - [0.22, 0.605], - [0.760, 0.605] - ], - weddingringpositions: [ - [0.51,0.24] - ], + captions:[ [0.22, 0.605], + [0.760, 0.605] + ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "boy2.svg"], currentstate: ["deactive", "deactive", "active", "activeto"], - edgeState:["others","others","others","others"], + edgeState:["married","others","others","others"], answer: [qsTr("Brother")], optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, // level 4 - { edgeList: [ - [0.41, 0.25, 0.51, 0.25], - [0.55, 0.25, 0.64, 0.25], - [0.53, 0.28, 0.33, 0.50], - [0.53, 0.28, 0.53, 0.50], - [0.53, 0.28, 0.70, 0.52] - ], + { edgeList: [ [0.41, 0.25, 0.64, 0.25], + [0.53, 0.26, 0.33, 0.50], + [0.53, 0.25, 0.53, 0.50], + [0.53, 0.25, 0.70, 0.52] + ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.22, 0.50], [0.43, 0.50], [0.65, 0.50] - ], + ], rationn: [80, 80, 80], - captions: [ - [0.281,0.77], - [0.50,0.75] + captions: [ [0.281,0.77], + [0.50,0.75] ], - weddingringpositions: [ - [0.51,0.24] - ], nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "girl1.svg", "boy2.svg"], currentstate: ["deactive", "deactive", "active", "activeto", "deactive"], - edgeState:["others","others","others","others","others"], + edgeState:["married","others","others","others"], answer: [qsTr("Sister")], optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, // level 5 - { edgeList: [ - [0.31, 0.17, 0.35, 0.17], - [0.39, 0.17, 0.43, 0.17], - [0.37, 0.19, 0.37, 0.40], - [0.44, 0.45, 0.520, 0.45], - [0.54, 0.45, 0.60, 0.45], - [0.525, 0.47, 0.525, 0.65], - [0.33, 0.65, 0.70, 0.65], - [0.33, 0.65, 0.33, 0.70], - [0.525, 0.65, 0.525, 0.70], - [0.70, 0.65, 0.70, 0.725] + { edgeList: [ [0.48, 0.17, 0.567, 0.17], + [0.525, 0.17, 0.525, 0.45], + [0.44, 0.45, 0.60, 0.45], + [0.525, 0.45, 0.525, 0.65], + [0.33, 0.65, 0.70, 0.65], + [0.33, 0.65, 0.33, 0.70], + [0.525, 0.65, 0.525, 0.70], + [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ - [0.1211, 0.10], - [0.423, 0.10], - [0.251, 0.40], - [0.588, 0.40], - [0.22, 0.70], - [0.43, 0.70], - [0.65, 0.70] + [0.2911, 0.10], + [0.553, 0.10], + [0.251, 0.40], + [0.588, 0.40], + [0.22, 0.70], + [0.43, 0.70], + [0.65, 0.70] ], rationn: [80, 80, 80], - captions: [ - [0.09,0.76], - [0.02,0.17], - ], - weddingringpositions: [ - [0.350,0.16], - [0.515,0.43] - ], + captions: [ [0.118,0.76], + [0.22,0.17], + ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "girl1.svg", "boy1.svg", "boy2.svg"], currentstate: ["activeto", "deactive", "deactive", "deactive", "active", "deactive", "deactive"], - edgeState:["others","others","others","others","others","others","others","others","others","others" ], + edgeState:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Grandfather")], optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] }, // level 6 - { edgeList: [ - [0.31, 0.17, 0.35, 0.17], - [0.39, 0.17, 0.43, 0.17], - [0.37, 0.19, 0.37, 0.40], - [0.44, 0.45, 0.520, 0.45], - [0.54, 0.45, 0.60, 0.45], - [0.525, 0.47, 0.525, 0.65], - [0.33, 0.65, 0.70, 0.65], - [0.33, 0.65, 0.33, 0.70], - [0.525, 0.65, 0.525, 0.70], - [0.70, 0.65, 0.70, 0.725] - ], - nodePositions: [ - [0.1211, 0.10], - [0.423, 0.10], - [0.251, 0.40], - [0.588, 0.40], - [0.22, 0.70], - [0.43, 0.70], - [0.65, 0.70] - ], - rationn: [80, 80, 80], - captions: [ - [0.70,0.76], - [0.853,0.16] - ], - weddingringpositions: [ - [0.350,0.16], - [0.515,0.43] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "active"], - edgeState:["others","others","others","others","others","others","others","others","others","others"], - answer: [qsTr("Grandmother")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")], - }, - // level 7 - { edgeList: [ - [0.31, 0.17, 0.35, 0.17], - [0.39, 0.17, 0.43, 0.17], - [0.37, 0.19, 0.37, 0.40], - [0.44, 0.45, 0.520, 0.45], - [0.54, 0.45, 0.60, 0.45], - [0.525, 0.47, 0.525, 0.65], - [0.33, 0.65, 0.70, 0.65], - [0.33, 0.65, 0.33, 0.70], - [0.525, 0.65, 0.525, 0.70], - [0.70, 0.65, 0.70, 0.725] - ], - nodePositions: [ - [0.1211, 0.10], - [0.423, 0.10], + { edgeList: [ [0.48, 0.17, 0.567, 0.17], + [0.525, 0.17, 0.525, 0.45], + [0.44, 0.45, 0.60, 0.45], + [0.525, 0.45, 0.525, 0.65], + [0.33, 0.65, 0.70, 0.65], + [0.33, 0.65, 0.33, 0.70], + [0.525, 0.65, 0.525, 0.70], + [0.70, 0.65, 0.70, 0.725] + ], + nodePositions: [ + [0.2911, 0.10], + [0.553, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], - captions: [ - [0.02,0.17], - [0.85,0.76] + captions: [ [0.85,0.76], + [0.743,0.16] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], + currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "active"], + edgeState:["married","others","married","others","others","others","others","others" ], + answer: [qsTr("Grandmother")], + optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")], + }, + // level 7 + { edgeList: [ [0.48, 0.17, 0.567, 0.17], + [0.525, 0.17, 0.525, 0.45], + [0.44, 0.45, 0.60, 0.45], + [0.525, 0.45, 0.525, 0.65], + [0.33, 0.65, 0.70, 0.65], + [0.33, 0.65, 0.33, 0.70], + [0.525, 0.65, 0.525, 0.70], + [0.70, 0.65, 0.70, 0.725] ], - weddingringpositions: [ [0.350,0.16], - [0.515,0.43] + nodePositions: [ + [0.2911, 0.10], + [0.553, 0.10], + [0.251, 0.40], + [0.588, 0.40], + [0.22, 0.70], + [0.43, 0.70], + [0.65, 0.70] ], + rationn: [80, 80, 80], + captions: [ [0.17,0.17], + [0.85,0.76] + ], nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "boy2.svg","girl1.svg" ], currentstate: ["active", "deactive", "deactive", "deactive", "deactive", "deactive", "activeto"], - edgeState:["others","others","others","others","others","others","others","others","others","others"], + edgeState:["married","others","married","others","others","others","others","others" ], answer: [qsTr("Granddaughter")], optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] }, // level 8 - { edgeList: [ - [0.31, 0.17, 0.35, 0.17], - [0.39, 0.17, 0.43, 0.17], - [0.37, 0.19, 0.37, 0.40], - [0.44, 0.45, 0.520, 0.45], - [0.54, 0.45, 0.60, 0.45], - [0.525, 0.47, 0.525, 0.65], + { edgeList: [ [0.48, 0.17, 0.567, 0.17], + [0.525, 0.17, 0.525, 0.45], + [0.44, 0.45, 0.60, 0.45], + [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] - ], - nodePositions: [ - [0.1211, 0.10], - [0.423, 0.10], - [0.251, 0.40], - [0.588, 0.40], - [0.22, 0.70], - [0.43, 0.70], - [0.65, 0.70] - ], - rationn: [80, 80, 80], - captions: [ - [0.653,0.16], + ], + nodePositions: [ + [0.2911, 0.10], + [0.553, 0.10], + [0.251, 0.40], + [0.588, 0.40], + [0.22, 0.70], + [0.43, 0.70], + [0.65, 0.70] + ], + rationn: [80, 80, 80], + captions: [ [0.743,0.16], [0.85,0.76] ], - weddingringpositions: [ - [0.350,0.16], - [0.515,0.43] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "active", "deactive", "deactive", "deactive", "deactive", "activeto", "active"], - edgeState:["others","others","others","others","others","others","others","others","others","others" ], - answer: [qsTr("Grandson")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], + currentstate: ["deactive", "active", "deactive", "deactive", "deactive", "deactive", "activeto", "active"], + edgeState:["married","others","married","others","others","others","others","others" ], + answer: [qsTr("Grandson")], + optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] }, // level 9 - { edgeList: [ - [0.50, 0.17, 0.53, 0.17], + { edgeList: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], - nodePositions: [ + nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] - ], - rationn: [80, 80, 80], - captions: [ - [0.118,0.76], + ], + rationn: [80, 80, 80], + captions: [ [0.118,0.76], [0.83,0.45] - ], - weddingringpositions: [], - nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "activeto", "active"], - edgeState:["others","others","others","others","others","others"], - answer: [qsTr("Uncle")], - optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] + ], + nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], + currentstate: ["deactive", "deactive", "activeto", "active"], + edgeState:["others","others","siblings","others","others","others"], + answer: [qsTr("Uncle")], + optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] }, // level 10 - { edgeList: [ - [0.50, 0.17, 0.53, 0.17], + { edgeList: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], - nodePositions: [ + nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], - rationn: [80, 80, 80], - captions: [ - [0.83,0.45], + rationn: [80, 80, 80], + captions: [ [0.83,0.45], [0.118,0.76], ], - weddingringpositions: [], - nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "active", "activeto"], - edgeState:["others","others","others","others","others","others"], - answer: [qsTr("Nephew")], - optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] + nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], + currentstate: ["deactive", "deactive", "active", "activeto"], + edgeState:["others","others","siblings","others","others","others"], + answer: [qsTr("Nephew")], + optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] }, // level 11 - { edgeList: [ - [0.47, 0.17, 0.50, 0.17], - [0.52, 0.17, 0.56, 0.17], - [0.515, 0.17, 0.515, 0.45], + { edgeList: [ [0.49, 0.17, 0.56, 0.17], + [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], - nodePositions: [ - [0.28, 0.10], + nodePositions: [ + [0.301, 0.10], [0.553, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], - rationn: [80, 80, 80], - captions: [ - [0.118,0.76], + rationn: [80, 80, 80], + captions: [ [0.118,0.76], [0.83,0.45], ], - weddingringpositions: [ - [0.49,0.16] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Aunt")], - optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], + currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + edgeState:["married","others","siblings","others","others","others"], + answer: [qsTr("Aunt")], + optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] }, // level 12 - { edgeList: [ - [0.47, 0.17, 0.50, 0.17], - [0.52, 0.17, 0.545, 0.17], - [0.515, 0.17, 0.515, 0.45], + { edgeList: [ [0.48, 0.17, 0.55, 0.17], + [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] - ], - nodePositions: [ - [0.28, 0.10], - [0.533, 0.10], + ], + nodePositions: [ + [0.291, 0.10], + [0.543, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] - ], - rationn: [80, 80, 80], - captions: [ [0.83,0.45], - [0.118,0.76] - ], - weddingringpositions: [[0.49,0.16]], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Niece")], - optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] + ], + rationn: [80, 80, 80], + captions: [ [0.83,0.45], + [0.118,0.76] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], + currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + edgeState:["married","others","siblings","others","others","others"], + answer: [qsTr("Niece")], + optionss: [qsTr("Uncle"), qsTr("Aunt"), qsTr("Nephew"), qsTr("Niece")] }, // level 13 - { edgeList: [ - [0.65, 0.16, 0.685, 0.16], - [0.72, 0.16, 0.76, 0.16], - [0.71, 0.19, 0.71, 0.70], - [0.70, 0.50, 0.62, 0.50], - [0.46, 0.52, 0.41, 0.52], - [0.38, 0.52, 0.33, 0.52], - [0.705, 0.695, 0.76, 0.695] - ], - nodePositions: [ + { edgeList: [ [0.65, 0.16, 0.745, 0.16], + [0.70, 0.16, 0.70, 0.70], + [0.70, 0.50, 0.58, 0.50], + [0.405, 0.53, 0.345, 0.53], + [0.69, 0.695, 0.75, 0.695] + ], + nodePositions: [ [0.463, 0.10], - [0.75, 0.10], - [0.450, 0.45], + [0.733, 0.10], + [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] - ], - rationn: [80, 80, 80], - captions: [ - [0.02,0.51], + ], + rationn: [80, 80, 80], + captions: [ [0.02,0.51], [0.32,0.16] ], - weddingringpositions: [ - [0.685,0.15], - [0.38,0.50] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["activeto", "deactive", "deactive", "active", "deactive"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Father-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["activeto", "deactive", "deactive", "active", "deactive"], + edgeState:["married","others","others","married","others"], + answer: [qsTr("Father-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, // level 14 - { edgeList: [ - [0.65, 0.16, 0.685, 0.16], - [0.72, 0.16, 0.76, 0.16], - [0.71, 0.19, 0.71, 0.70], - [0.70, 0.50, 0.62, 0.50], - [0.46, 0.52, 0.41, 0.52], - [0.38, 0.52, 0.33, 0.52], - [0.705, 0.695, 0.76, 0.695] - ], - nodePositions: [ - [0.463, 0.10], - [0.75, 0.10], - [0.450, 0.45], - [0.150, 0.45], - [0.733, 0.67] - ], - rationn: [80, 80, 80], - captions: [ - [0.02,0.51], + { edgeList: [ [0.65, 0.16, 0.745, 0.16], + [0.70, 0.16, 0.70, 0.70], + [0.70, 0.50, 0.58, 0.50], + [0.405, 0.53, 0.345, 0.53], + [0.69, 0.695, 0.75, 0.695] + ], + nodePositions: [ + [0.463, 0.10], + [0.733, 0.10], + [0.400, 0.45], + [0.150, 0.45], + [0.733, 0.67] + ], + rationn: [80, 80, 80], + captions: [ [0.02,0.51], [0.80,0.365], - ], - weddingringpositions: [ - [0.685,0.15], - [0.38,0.50] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "activeto", "deactive", "active", "deactive"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Mother-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["deactive", "activeto", "deactive", "active", "deactive"], + edgeState:["married","others","others","married","others"], + answer: [qsTr("Mother-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, // level 15 - { edgeList: [ - [0.65, 0.16, 0.685, 0.16], - [0.72, 0.16, 0.76, 0.16], - [0.71, 0.19, 0.71, 0.70], - [0.70, 0.50, 0.62, 0.50], - [0.46, 0.52, 0.41, 0.52], - [0.38, 0.52, 0.33, 0.52], - [0.705, 0.695, 0.76, 0.695] - ], - nodePositions: [ - [0.463, 0.10], - [0.75, 0.10], - [0.450, 0.45], - [0.150, 0.45], - [0.733, 0.67] - ], - rationn: [80, 80, 80], - captions: [ - [0.02,0.51], + { edgeList: [ [0.65, 0.16, 0.745, 0.16], + [0.70, 0.16, 0.70, 0.70], + [0.70, 0.50, 0.58, 0.50], + [0.405, 0.53, 0.345, 0.53], + [0.69, 0.695, 0.75, 0.695] + ], + nodePositions: [ + [0.463, 0.10], + [0.733, 0.10], + [0.400, 0.45], + [0.150, 0.45], + [0.733, 0.67] + ], + rationn: [80, 80, 80], + captions: [ [0.02,0.51], [0.78,0.5340] ], - weddingringpositions: [ - [0.685,0.15], - [0.38,0.50] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Brother-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + edgeState:["married","others","others","married","others"], + answer: [qsTr("Brother-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, // level 16 - { edgeList: [ - [0.52, 0.16, 0.56, 0.16], - [0.595, 0.16, 0.65, 0.16], - [0.58, 0.19, 0.58, 0.70], + { edgeList: [ [0.54, 0.16, 0.61, 0.16], + [0.58, 0.16, 0.58, 0.70], [0.58, 0.50, 0.475, 0.50], - [0.310, 0.52, 0.275, 0.52], - [0.25, 0.52, 0.205, 0.52], + [0.310, 0.53, 0.235, 0.53], [0.57, 0.695, 0.63, 0.695], - [0.615, 0.75, 0.57, 0.75], - [0.55, 0.75, 0.49, 0.75] + [0.615, 0.765, 0.51, 0.765] ], - nodePositions: [ - [0.33, 0.10], - [0.623, 0.10], + nodePositions: [ + [0.343, 0.10], + [0.603, 0.10], [0.300, 0.45], - [0.020, 0.45], + [0.040, 0.45], [0.603, 0.67], [0.30, 0.70] ], - rationn: [80, 80, 80], - captions: [ - [0.10,0.34], + rationn: [80, 80, 80], + captions: [ [0.10,0.34], [0.20,0.76] ], - weddingringpositions: [ - [0.56,0.15], - [0.235,0.50], - [0.54,0.73] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg", "lady1.svg"], - currentstate: ["dective", "deactive", "deactive", "active", "deactive", "activeto"], - edgeState:["others","others","others","others","others","others","others","others","others"], - answer: [qsTr("Sister-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg", "lady1.svg"], + currentstate: ["dective", "deactive", "deactive", "active", "deactive", "activeto"], + edgeState:["married","others","others","married","others","married"], + answer: [qsTr("Sister-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, // level 17 - { edgeList: [ - [0.65, 0.16, 0.685, 0.16], - [0.72, 0.16, 0.76, 0.16], - [0.71, 0.19, 0.71, 0.70], - [0.70, 0.50, 0.62, 0.50], - [0.46, 0.52, 0.41, 0.52], - [0.38, 0.52, 0.33, 0.52], - [0.705, 0.695, 0.76, 0.695] - ], - nodePositions: [ - [0.463, 0.10], - [0.75, 0.10], - [0.450, 0.45], - [0.150, 0.45], - [0.733, 0.67] - ], - rationn: [80, 80, 80], - captions: [ - [0.32,0.15], + { edgeList: [ [0.65, 0.16, 0.745, 0.16], + [0.70, 0.16, 0.70, 0.70], + [0.70, 0.50, 0.58, 0.50], + [0.41, 0.53, 0.34, 0.53], + [0.69, 0.695, 0.75, 0.695] + ], + nodePositions: [ + [0.463, 0.10], + [0.733, 0.10], + [0.400, 0.45], + [0.150, 0.45], + [0.733, 0.67] + ], + rationn: [80, 80, 80], + captions: [ [0.32,0.15], [0.05,0.50] ], - weddingringpositions: [ - [0.685,0.15], - [0.38,0.50] - ], - nodeleave: ["grandfather.svg", "old-lady.svg", "lady2.svg", "man3.svg", "man1.svg"], - currentstate: ["active", "deactive", "deactive", "activeto", "deactive", "deactive"], - edgeState:["others","others","others","others","others","others","others"], - answer: [qsTr("Son-in-law")], - optionss: [qsTr("Son-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - } + nodeleave: ["grandfather.svg", "old-lady.svg", "lady2.svg", "man3.svg", "man1.svg"], + currentstate: ["active", "deactive", "deactive", "activeto", "deactive", "deactive"], + edgeState:["married","others","others","married","others"], + answer: [qsTr("Son-in-law")], + optionss: [qsTr("Son-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] + } ] var numberOfLevel = treeStructure.length; var answerButtonRatio = 0; function start(items_) { items = items_ currentLevel = 0 initLevel() } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 var levelTree = treeStructure[currentLevel] answerButtonRatio = 1/(levelTree.optionss.length+4); items.nodeCreator.model.clear(); items.answersChoice.model.clear(); items.edgeCreator.model.clear(); - items.weddingringcreator.model.clear(); + items.wringcreator.model.clear(); for(var i = 0 ; i < levelTree.nodePositions.length ; i++) { items.nodeCreator.model.append({ "xx": levelTree.nodePositions[i][0], "yy": levelTree.nodePositions[i][1], "nodee": levelTree.nodeleave[i], "rationn": levelTree.rationn[i], "currentstate": levelTree.currentstate[i] }); } for(var j = 0 ; j