diff --git a/extensions/community/Scrollbar.json b/extensions/community/Scrollbar.json index dd6404036..a1ba59316 100644 --- a/extensions/community/Scrollbar.json +++ b/extensions/community/Scrollbar.json @@ -10,7 +10,7 @@ "name": "Scrollbar", "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", "shortDescription": "A scrollbar to help making a scroll view.", - "version": "1.0.1", + "version": "1.0.2", "description": [ "A scrollbar to help making a scroll view.", "", @@ -32,9 +32,163 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Move the camera according to the scroll position.", + "fullName": "Set camera from scroll", + "functionType": "Action", + "group": "Scrollbar", + "name": "SetCameraFromPosition", + "sentence": "Move the camera of _PARAM2_ according to the scroll position of _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "mod(round(Object.Angle() / 90), 2)", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraCenterY" + }, + "parameters": [ + "", + "=", + "Object.ScrollPosition() + CameraHeight(ScrolledLayer) / 2", + "ScrolledLayer", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Else", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetCameraCenterX" + }, + "parameters": [ + "", + "=", + "Object.ScrollPosition() + CameraWidth(ScrolledLayer) / 2", + "ScrolledLayer", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Scrollbar::Scrollbar", + "type": "objectList" + }, + { + "description": "Scrolled layer", + "name": "ScrolledLayer", + "type": "layer" + } + ], + "objectGroups": [] + }, + { + "description": "Change the scroll position according to the camera.", + "fullName": "Set scroll from camera", + "functionType": "Action", + "group": "Scrollbar", + "name": "SetPositionFromCamera", + "sentence": "Change the scroll position of _PARAM1_ according to the camera of _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "mod(round(Object.Angle() / 90), 2)", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Scrollbar::Scrollbar::SetScrollPosition" + }, + "parameters": [ + "Object", + "=", + "CameraCenterY(ScrolledLayer) - CameraHeight(ScrolledLayer) / 2", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Else", + "conditions": [], + "actions": [ + { + "type": { + "value": "Scrollbar::Scrollbar::SetScrollPosition" + }, + "parameters": [ + "Object", + "=", + "CameraCenterX(ScrolledLayer) - CameraWidth(ScrolledLayer) / 2", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Scrollbar::Scrollbar", + "type": "objectList" + }, + { + "description": "Scrolled layer", + "name": "ScrolledLayer", + "type": "layer" + } + ], + "objectGroups": [] + } + ], "eventsFunctionsFolderStructure": { - "folderName": "__ROOT" + "folderName": "__ROOT", + "children": [ + { + "folderName": "Scrollbar", + "children": [ + { + "functionName": "SetCameraFromPosition" + }, + { + "functionName": "SetPositionFromCamera" + } + ] + } + ] }, "eventsBasedBehaviors": [], "eventsBasedObjects": [ @@ -581,12 +735,11 @@ "objectGroups": [] }, { - "description": "the top position of the displayed part.", - "fullName": "Scroll top position", + "description": "the top or left position of the displayed part.", + "fullName": "Scroll position", "functionType": "ExpressionAndCondition", "name": "ScrollPosition", - "private": true, - "sentence": "the scroll top position", + "sentence": "the scroll position", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -821,181 +974,6 @@ } ], "objectGroups": [] - }, - { - "description": "the center position of the displayed part.", - "fullName": "Scroll center position", - "functionType": "ExpressionAndCondition", - "name": "ScrollCenter", - "sentence": "the scroll center position", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ScrollPosition + Background.Height() / 2" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "Scrollbar::Scrollbar", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "the bottom position of the displayed part.", - "fullName": "Scroll bottom position", - "functionType": "ExpressionAndCondition", - "name": "ScrollBottom", - "sentence": "the scroll bottom position", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ScrollPosition + Background.Height()" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "Scrollbar::Scrollbar", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "the top position of the displayed part.", - "fullName": "Scroll top position", - "functionType": "ExpressionAndCondition", - "name": "ScrollTop", - "sentence": "the scroll top position", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ScrollPosition" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "Scrollbar::Scrollbar", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ScrollCenter", - "name": "SetScrollCenter", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Scrollbar::Scrollbar::SetScrollPosition" - }, - "parameters": [ - "Object", - "=", - "Value - Background.Height() / 2", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "Scrollbar::Scrollbar", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ScrollBottom", - "name": "SetScrollBottom", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Scrollbar::Scrollbar::SetScrollPosition" - }, - "parameters": [ - "Object", - "=", - "Value - Background.Height()", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "Scrollbar::Scrollbar", - "type": "object" - } - ], - "objectGroups": [] } ], "eventsFunctionsFolderStructure": { @@ -1013,21 +991,6 @@ { "functionName": "SetScrollPosition" }, - { - "functionName": "ScrollTop" - }, - { - "functionName": "ScrollCenter" - }, - { - "functionName": "SetScrollCenter" - }, - { - "functionName": "ScrollBottom" - }, - { - "functionName": "SetScrollBottom" - }, { "functionName": "ContentLength" },