Skip to content

Commit 60688a1

Browse files
authored
[Reviewed] [Scrollbar] Fix the thumb sometimes overflowing the bar (#2106)
1 parent c7a613a commit 60688a1

1 file changed

Lines changed: 260 additions & 9 deletions

File tree

extensions/community/Scrollbar.json

Lines changed: 260 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"author": "",
33
"category": "User interface",
4+
"dimension": "2D",
45
"extensionNamespace": "",
56
"fullName": "Scrollbar",
67
"gdevelopVersion": "",
@@ -9,11 +10,16 @@
910
"name": "Scrollbar",
1011
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Interface Elements/c1313ac0735bd1c08d7327fd9a56b4d8cebf1b343f9ba82f1b141358433e1cdb_Interface Elements_interface_ui_scroll_bar_scrollbar.svg",
1112
"shortDescription": "A scrollbar to help making a scroll view.",
12-
"version": "1.0.0",
13+
"version": "1.0.1",
1314
"description": [
1415
"A scrollbar to help making a scroll view.",
1516
"",
16-
"An example of scroll view can be found in the [multiplayer custom lobbies](https://wiki.gdevelop.io/gdevelop5/extensions/multiplayer-custom-lobbies/) extension."],
17+
"An example of scroll view can be found in the [multiplayer custom lobbies](https://wiki.gdevelop.io/gdevelop5/extensions/multiplayer-custom-lobbies/) extension."
18+
],
19+
"origin": {
20+
"identifier": "Scrollbar",
21+
"name": "gdevelop-extension-store"
22+
},
1723
"tags": [
1824
"scroll",
1925
"bar"
@@ -27,6 +33,9 @@
2733
"globalVariables": [],
2834
"sceneVariables": [],
2935
"eventsFunctions": [],
36+
"eventsFunctionsFolderStructure": {
37+
"folderName": "__ROOT"
38+
},
3039
"eventsBasedBehaviors": [],
3140
"eventsBasedObjects": [
3241
{
@@ -40,9 +49,12 @@
4049
"defaultName": "",
4150
"description": "A scrollbar to help making a scroll view.",
4251
"fullName": "Scrollbar",
52+
"helpPath": "",
53+
"iconUrl": "",
4354
"isInnerAreaFollowingParentSize": true,
4455
"isUsingLegacyInstancesRenderer": false,
4556
"name": "Scrollbar",
57+
"previewIconUrl": "",
4658
"objects": [
4759
{
4860
"assetStoreId": "",
@@ -127,6 +139,7 @@
127139
"ambientLightColorB": 200,
128140
"ambientLightColorG": 200,
129141
"ambientLightColorR": 200,
142+
"camera2DPlaneMaxDrawingDistance": 5000,
130143
"camera3DFarPlaneDistance": 10000,
131144
"camera3DFieldOfView": 45,
132145
"camera3DNearPlaneDistance": 3,
@@ -186,6 +199,7 @@
186199
"initialVariables": []
187200
}
188201
],
202+
"editionSettings": [],
189203
"eventsFunctions": [
190204
{
191205
"fullName": "",
@@ -453,7 +467,7 @@
453467
"parameters": [
454468
"Object",
455469
"=",
456-
"(Thumb.Y() - Background.Y()) * ContentLength / Background.Height()",
470+
"(Thumb.Y() - Background.Y()) * (ContentLength - Background.Height()) / (Background.Height() - Thumb.Height())",
457471
""
458472
]
459473
}
@@ -550,7 +564,7 @@
550564
"parameters": [
551565
"Thumb",
552566
"=",
553-
"clamp(Background.Y(), Background.Y() + Background.Height(), Background.Y() + ScrollPosition * Background.Height() / ContentLength)"
567+
"clamp(Background.Y(), Background.Y() + Background.Height() - Thumb.Height(), Background.Y() + ScrollPosition * (Background.Height() - Thumb.Height()) / (ContentLength - Background.Height()))"
554568
]
555569
}
556570
]
@@ -567,11 +581,12 @@
567581
"objectGroups": []
568582
},
569583
{
570-
"description": "the scroll position.",
571-
"fullName": "Scroll position",
584+
"description": "the top position of the displayed part.",
585+
"fullName": "Scroll top position",
572586
"functionType": "ExpressionAndCondition",
573587
"name": "ScrollPosition",
574-
"sentence": "the scroll position",
588+
"private": true,
589+
"sentence": "the scroll top position",
575590
"events": [
576591
{
577592
"type": "BuiltinCommonInstructions::Standard",
@@ -806,8 +821,227 @@
806821
}
807822
],
808823
"objectGroups": []
824+
},
825+
{
826+
"description": "the center position of the displayed part.",
827+
"fullName": "Scroll center position",
828+
"functionType": "ExpressionAndCondition",
829+
"name": "ScrollCenter",
830+
"sentence": "the scroll center position",
831+
"events": [
832+
{
833+
"type": "BuiltinCommonInstructions::Standard",
834+
"conditions": [],
835+
"actions": [
836+
{
837+
"type": {
838+
"value": "SetReturnNumber"
839+
},
840+
"parameters": [
841+
"ScrollPosition + Background.Height() / 2"
842+
]
843+
}
844+
]
845+
}
846+
],
847+
"expressionType": {
848+
"type": "expression"
849+
},
850+
"parameters": [
851+
{
852+
"description": "Object",
853+
"name": "Object",
854+
"supplementaryInformation": "Scrollbar::Scrollbar",
855+
"type": "object"
856+
}
857+
],
858+
"objectGroups": []
859+
},
860+
{
861+
"description": "the bottom position of the displayed part.",
862+
"fullName": "Scroll bottom position",
863+
"functionType": "ExpressionAndCondition",
864+
"name": "ScrollBottom",
865+
"sentence": "the scroll bottom position",
866+
"events": [
867+
{
868+
"type": "BuiltinCommonInstructions::Standard",
869+
"conditions": [],
870+
"actions": [
871+
{
872+
"type": {
873+
"value": "SetReturnNumber"
874+
},
875+
"parameters": [
876+
"ScrollPosition + Background.Height()"
877+
]
878+
}
879+
]
880+
}
881+
],
882+
"expressionType": {
883+
"type": "expression"
884+
},
885+
"parameters": [
886+
{
887+
"description": "Object",
888+
"name": "Object",
889+
"supplementaryInformation": "Scrollbar::Scrollbar",
890+
"type": "object"
891+
}
892+
],
893+
"objectGroups": []
894+
},
895+
{
896+
"description": "the top position of the displayed part.",
897+
"fullName": "Scroll top position",
898+
"functionType": "ExpressionAndCondition",
899+
"name": "ScrollTop",
900+
"sentence": "the scroll top position",
901+
"events": [
902+
{
903+
"type": "BuiltinCommonInstructions::Standard",
904+
"conditions": [],
905+
"actions": [
906+
{
907+
"type": {
908+
"value": "SetReturnNumber"
909+
},
910+
"parameters": [
911+
"ScrollPosition"
912+
]
913+
}
914+
]
915+
}
916+
],
917+
"expressionType": {
918+
"type": "expression"
919+
},
920+
"parameters": [
921+
{
922+
"description": "Object",
923+
"name": "Object",
924+
"supplementaryInformation": "Scrollbar::Scrollbar",
925+
"type": "object"
926+
}
927+
],
928+
"objectGroups": []
929+
},
930+
{
931+
"fullName": "",
932+
"functionType": "ActionWithOperator",
933+
"getterName": "ScrollCenter",
934+
"name": "SetScrollCenter",
935+
"sentence": "",
936+
"events": [
937+
{
938+
"type": "BuiltinCommonInstructions::Standard",
939+
"conditions": [],
940+
"actions": [
941+
{
942+
"type": {
943+
"value": "Scrollbar::Scrollbar::SetScrollPosition"
944+
},
945+
"parameters": [
946+
"Object",
947+
"=",
948+
"Value - Background.Height() / 2",
949+
""
950+
]
951+
}
952+
]
953+
}
954+
],
955+
"parameters": [
956+
{
957+
"description": "Object",
958+
"name": "Object",
959+
"supplementaryInformation": "Scrollbar::Scrollbar",
960+
"type": "object"
961+
}
962+
],
963+
"objectGroups": []
964+
},
965+
{
966+
"fullName": "",
967+
"functionType": "ActionWithOperator",
968+
"getterName": "ScrollBottom",
969+
"name": "SetScrollBottom",
970+
"sentence": "",
971+
"events": [
972+
{
973+
"type": "BuiltinCommonInstructions::Standard",
974+
"conditions": [],
975+
"actions": [
976+
{
977+
"type": {
978+
"value": "Scrollbar::Scrollbar::SetScrollPosition"
979+
},
980+
"parameters": [
981+
"Object",
982+
"=",
983+
"Value - Background.Height()",
984+
""
985+
]
986+
}
987+
]
988+
}
989+
],
990+
"parameters": [
991+
{
992+
"description": "Object",
993+
"name": "Object",
994+
"supplementaryInformation": "Scrollbar::Scrollbar",
995+
"type": "object"
996+
}
997+
],
998+
"objectGroups": []
809999
}
8101000
],
1001+
"eventsFunctionsFolderStructure": {
1002+
"folderName": "__ROOT",
1003+
"children": [
1004+
{
1005+
"functionName": "doStepPostEvents"
1006+
},
1007+
{
1008+
"functionName": "UpdateThumbPosition"
1009+
},
1010+
{
1011+
"functionName": "ScrollPosition"
1012+
},
1013+
{
1014+
"functionName": "SetScrollPosition"
1015+
},
1016+
{
1017+
"functionName": "ScrollTop"
1018+
},
1019+
{
1020+
"functionName": "ScrollCenter"
1021+
},
1022+
{
1023+
"functionName": "SetScrollCenter"
1024+
},
1025+
{
1026+
"functionName": "ScrollBottom"
1027+
},
1028+
{
1029+
"functionName": "SetScrollBottom"
1030+
},
1031+
{
1032+
"functionName": "ContentLength"
1033+
},
1034+
{
1035+
"functionName": "SetContentLength"
1036+
},
1037+
{
1038+
"functionName": "IsThumbDragged"
1039+
},
1040+
{
1041+
"functionName": "IsScrollingRequired"
1042+
}
1043+
]
1044+
},
8111045
"propertyDescriptors": [
8121046
{
8131047
"value": "0",
@@ -839,7 +1073,24 @@
8391073
"label": "Hide the bar when the content is too small",
8401074
"name": "ShouldHideWhenUseless"
8411075
}
842-
]
1076+
],
1077+
"propertiesFolderStructure": {
1078+
"folderName": "__ROOT",
1079+
"children": [
1080+
{
1081+
"propertyName": "ScrollPosition"
1082+
},
1083+
{
1084+
"propertyName": "ContentLength"
1085+
},
1086+
{
1087+
"propertyName": "ThumbLengthMin"
1088+
},
1089+
{
1090+
"propertyName": "ShouldHideWhenUseless"
1091+
}
1092+
]
1093+
}
8431094
}
8441095
]
845-
}
1096+
}

0 commit comments

Comments
 (0)