From 5b96c7a3e18b0e0018bba54b55ea4496229a6af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Fri, 8 May 2026 16:37:36 +0200 Subject: [PATCH 1/2] Revert "Remove the custom object" This reverts commit 91644b165d1dd9208af772b29d07d3158f8a6774. --- examples/scrollbar/scrollbar.json | 923 ++++++++++++++++++++++++++++++ 1 file changed, 923 insertions(+) diff --git a/examples/scrollbar/scrollbar.json b/examples/scrollbar/scrollbar.json index 5a531cd83..6c87824f5 100644 --- a/examples/scrollbar/scrollbar.json +++ b/examples/scrollbar/scrollbar.json @@ -671,6 +671,32 @@ ] } ] + }, + { + "assetStoreId": "", + "name": "NewScrollableText", + "persistentUuid": "a325f0bc-13bc-451a-b5bf-4dafe29ce287", + "type": "ScrollableText::ScrollableText", + "variant": "", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "TextContent": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.\n\nUt velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.\nAliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet." + } + }, + { + "assetStoreId": "", + "name": "NewScrollableText3", + "persistentUuid": "5384246b-92ca-40dd-91d8-c2ff3712b229", + "type": "ScrollableText::ScrollableText", + "variant": "", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "TextContent": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." + } } ], "objectsFolderStructure": { @@ -699,6 +725,12 @@ }, { "objectName": "WinterBackground" + }, + { + "objectName": "NewScrollableText" + }, + { + "objectName": "NewScrollableText3" } ] }, @@ -8604,6 +8636,897 @@ }, "eventsBasedBehaviors": [], "eventsBasedObjects": [] + }, + { + "author": "", + "category": "User interface", + "dimension": "", + "extensionNamespace": "", + "fullName": "Scrollable text", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI4LDMwSDRjLTEuMSwwLTItMC45LTItMlY0YzAtMS4xLDAuOS0yLDItMmgyNGMxLjEsMCwyLDAuOSwyLDJ2MjRDMzAsMjkuMSwyOS4xLDMwLDI4LDMweiIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIwIiB5MT0iMiIgeDI9IjIwIiB5Mj0iMzAiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI3LDI0IDI1LDI2IDIzLDI0ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjMsOCAyNSw2IDI3LDggIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iNiIgeTE9IjkiIHgyPSIxNiIgeTI9IjkiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSI2IiB5MT0iMTMiIHgyPSIxMiIgeTI9IjEzIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iNiIgeTE9IjE3IiB4Mj0iMTIiIHkyPSIxNyIvPg0KPC9zdmc+DQo=", + "name": "ScrollableText", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Interface Elements/0eeb1d19928934f1063c41710e713ba85b55e994d602c8f2d9a9e5a102df8c5e_Interface Elements_interface_ui_vertical_scroll_area_box_text.svg", + "shortDescription": "A text that can be scrolled with touch and a scrollbar.", + "version": "1.0.0", + "description": "A text that can be scrolled with touch and a scrollbar.", + "tags": [], + "authorIds": [], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT" + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 440, + "areaMaxY": 338, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "defaultName": "", + "description": "Text that can be scrolled with touch and a scrollbar.", + "fullName": "Scrollable text", + "helpPath": "", + "iconUrl": "", + "isInnerAreaFollowingParentSize": true, + "isTextContainer": true, + "isUsingLegacyInstancesRenderer": false, + "name": "ScrollableText", + "previewIconUrl": "", + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "Text", + "persistentUuid": "eb367917-799f-4de5-8af3-ea8368a9d9a1", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + } + ], + "string": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.", + "font": "", + "textAlignment": "left", + "characterSize": 18, + "color": { + "b": 29, + "g": 29, + "r": 29 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 18, + "lineHeight": 0, + "color": "29;29;29" + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Mask", + "persistentUuid": "3f200499-d561-41f6-8b4c-e3408196fa81", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ScrollableViewport", + "type": "ScrollableViewport::ScrollableViewport", + "Direction": "Vertical", + "IsDragged": false, + "StartX": 1.888759594395442e-306, + "StartY": 1.8887595943967276e-306, + "Layer": "" + } + ], + "animations": [ + { + "name": "White", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "metadata": "{\"pskl\":{}}", + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "White", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 0 + }, + { + "x": 64, + "y": 0 + }, + { + "x": 64, + "y": 64 + }, + { + "x": 0, + "y": 64 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "3b67abad485f3a4dee6271e8cdc41aee5e3f9da58939aeae39ad9dbd67e7140b", + "name": "ScrollBar", + "persistentUuid": "08ab7079-c9a0-4043-a084-785b97413bce", + "type": "Scrollbar::Scrollbar", + "variant": "Yellow rounded scroll bar", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 2, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": {} + }, + { + "assetStoreId": "", + "name": "BitmapText", + "persistentUuid": "c37ed84c-ddbe-43df-9fbb-d83e3024cb5d", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "This text use the default bitmap font.\nUse a custom Bitmap Font to create your own texts.", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "left", + "verticalTextAlignment": "top" + } + }, + { + "assetStoreId": "", + "bottomMargin": 0, + "height": 32, + "leftMargin": 0, + "name": "ContentBackground", + "persistentUuid": "73b38e51-3461-41eb-ba5a-7be4f49143b3", + "rightMargin": 0, + "texture": "LightGrey", + "tiled": false, + "topMargin": 0, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BitmapText" + }, + { + "objectName": "ContentBackground" + }, + { + "objectName": "ScrollBar" + }, + { + "objectName": "Mask" + } + ] + }, + "objectsGroups": [ + { + "name": "Content", + "objects": [ + { + "name": "Text" + }, + { + "name": "BitmapText" + }, + { + "name": "ContentBackground" + } + ] + }, + { + "name": "Texts", + "objects": [ + { + "name": "Text" + }, + { + "name": "BitmapText" + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + }, + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "UI", + "renderingType": "", + "visibility": true, + "cameras": [], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + }, + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "Mask", + "renderingType": "", + "visibility": false, + "cameras": [], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 64.18991097922849, + "height": 338, + "layer": "UI", + "name": "ScrollBar", + "persistentUuid": "10e8cd1d-db62-4922-a779-5c0e5fb0ab3c", + "width": 24, + "x": 416, + "y": 0, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 337, + "keepRatio": true, + "layer": "Mask", + "name": "Mask", + "persistentUuid": "6f2ea7a4-9811-49cd-9c1c-da0c30e6e71b", + "width": 440, + "x": 0, + "y": 0, + "zOrder": 0, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 271, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "9390cb66-ff7c-4880-a43f-970dc70f736b", + "width": 353, + "x": 34, + "y": 32, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 338, + "layer": "", + "name": "ContentBackground", + "persistentUuid": "6638ee83-466d-4926-a1a3-028b0470c2fe", + "width": 440, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 1.2255083237054676, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Texts", + "Text", + "=", + "Object.Text::Value()" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetHeight" + }, + "parameters": [ + "ContentBackground", + "Resizable", + "=", + "max(Object.Height(), Texts.Height() + 2 * (Texts.Y() - ContentBackground.Y()))" + ] + }, + { + "type": { + "value": "Scrollbar::Scrollbar::SetContentLength" + }, + "parameters": [ + "ScrollBar", + "=", + "ContentBackground.Height()", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Scrollbar::Scrollbar::IsThumbDragged" + }, + "parameters": [ + "ScrollBar", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Scrollbar::SetPositionFromCamera" + }, + "parameters": [ + "", + "ScrollBar", + "", + "" + ] + }, + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Mask", + "ScrollableViewport", + "yes" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Scrollbar::Scrollbar::IsThumbDragged" + }, + "parameters": [ + "ScrollBar", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Mask", + "ScrollableViewport", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Scrollbar::SetCameraFromPosition" + }, + "parameters": [ + "", + "ScrollBar", + "\"\"", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScrollableText::ScrollableText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ShowLayer" + }, + "parameters": [ + "", + "\"Mask\"" + ] + }, + { + "type": { + "value": "SpriteMasking::Mask" + }, + "parameters": [ + "", + "Content", + "Mask", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Object", + "Text", + "=", + "TextContent" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScrollableText::ScrollableText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the top position of the displayed part.", + "fullName": "Scroll position", + "functionType": "ExpressionAndCondition", + "name": "ScrollPosition", + "sentence": "the scroll position", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ScrollBar.ScrollPosition()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScrollableText::ScrollableText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ScrollPosition", + "name": "SetScrollPosition", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Scrollbar::Scrollbar::SetScrollPosition" + }, + "parameters": [ + "ScrollBar", + "=", + "Value", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScrollableText::ScrollableText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the length of the content to scroll.", + "fullName": "Content length", + "functionType": "ExpressionAndCondition", + "name": "ContentLength", + "sentence": "the content length", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ScrollBar.ContentLength()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScrollableText::ScrollableText", + "type": "object" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "ScrollPosition" + }, + { + "functionName": "SetScrollPosition" + }, + { + "functionName": "ContentLength" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "MultilineString", + "label": "Text", + "name": "TextContent" + }, + { + "value": "", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "", + "value": "Text.Text=TextContent" + }, + { + "label": "", + "value": "BitmapText.Text=TextContent" + } + ], + "hidden": true, + "name": "_PropertyMapping" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "TextContent" + }, + { + "propertyName": "_PropertyMapping" + } + ] + }, + "variants": [] + } + ] } ], "externalLayouts": [] From 43e9adf368aeac48f4354a966a2fa6b624e0e69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Fri, 8 May 2026 16:53:11 +0200 Subject: [PATCH 2/2] Use a custom object --- examples/scrollbar/scrollbar.json | 434 +++--------------------------- 1 file changed, 39 insertions(+), 395 deletions(-) diff --git a/examples/scrollbar/scrollbar.json b/examples/scrollbar/scrollbar.json index 6c87824f5..73d68e9c2 100644 --- a/examples/scrollbar/scrollbar.json +++ b/examples/scrollbar/scrollbar.json @@ -214,7 +214,7 @@ "gridColor": 10401023, "gridAlpha": 0.8, "snap": false, - "zoomFactor": 0.6672773998330016, + "zoomFactor": 0.5290357402156876, "windowMask": false, "selectedLayer": "", "gameEditorMode": "instances-editor" @@ -222,69 +222,11 @@ "objectsGroups": [ { "name": "Content", - "objects": [ - { - "name": "Text" - }, - { - "name": "ContentBackground" - } - ] + "objects": [] } ], "variables": [], "instances": [ - { - "angle": 0, - "customSize": true, - "depth": 64, - "height": 337, - "keepRatio": true, - "layer": "UI", - "name": "ScrollBar", - "persistentUuid": "9fb610d4-7863-4056-b30a-3821a7e0fc9b", - "width": 24, - "x": 468, - "y": 253, - "zOrder": 4, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": true, - "depth": 1, - "height": 1093, - "keepRatio": true, - "layer": "Scrolled", - "name": "Text", - "persistentUuid": "2cfd67ca-82d9-448c-9354-6fb7e7e0d9b5", - "width": 353, - "x": 85, - "y": 285, - "zOrder": 2, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": true, - "depth": 1, - "height": 1156, - "keepRatio": true, - "layer": "Scrolled", - "name": "ContentBackground", - "persistentUuid": "a3b36d9c-b854-43d9-b926-d883f3f4e8b5", - "width": 440, - "x": 51, - "y": 253, - "zOrder": 1, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, { "angle": 0, "customSize": true, @@ -350,142 +292,41 @@ "stringProperties": [], "initialVariables": [] }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "NewScrollableText", + "persistentUuid": "41c829bb-abac-4588-8454-a221c937bffe", + "width": 0, + "x": 50, + "y": 252, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, { "angle": 0, "customSize": true, - "depth": 1, - "height": 337, + "depth": 64, + "height": 228, "keepRatio": true, - "layer": "UI", - "name": "Mask", - "persistentUuid": "e878da70-93fb-4272-b246-dac9c0e86511", - "width": 443, - "x": 49, + "layer": "", + "name": "NewScrollableText2", + "persistentUuid": "5ecfdf53-f9e2-426f-bcff-645f2af32f91", + "width": 319, + "x": 638, "y": 253, - "zOrder": 0, + "zOrder": 15, "numberProperties": [], "stringProperties": [], "initialVariables": [] } ], "objects": [ - { - "assetStoreId": "3b67abad485f3a4dee6271e8cdc41aee5e3f9da58939aeae39ad9dbd67e7140b", - "name": "ScrollBar", - "persistentUuid": "31650ac1-7627-488b-ae00-a3cc4e5cde91", - "type": "Scrollbar::Scrollbar", - "variant": "Yellow rounded scroll bar", - "variables": [], - "effects": [], - "behaviors": [], - "content": {} - }, - { - "assetStoreId": "", - "bold": false, - "italic": false, - "name": "Text", - "persistentUuid": "b8ee8ebb-9207-4488-a7f1-06394e061e78", - "smoothed": true, - "type": "TextObject::Text", - "underlined": false, - "variables": [], - "effects": [], - "behaviors": [], - "string": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.\n\nUt velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.\nAliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.", - "font": "", - "textAlignment": "left", - "characterSize": 18, - "color": { - "b": 29, - "g": 29, - "r": 29 - }, - "content": { - "bold": false, - "isOutlineEnabled": false, - "isShadowEnabled": false, - "italic": false, - "outlineColor": "255;255;255", - "outlineThickness": 2, - "shadowAngle": 90, - "shadowBlurRadius": 2, - "shadowColor": "0;0;0", - "shadowDistance": 4, - "shadowOpacity": 127, - "smoothed": true, - "underlined": false, - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.\n\nUt velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.\nAliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.", - "font": "", - "textAlignment": "left", - "verticalTextAlignment": "top", - "characterSize": 18, - "lineHeight": 0, - "color": "29;29;29" - } - }, - { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "ContentBackground", - "persistentUuid": "a08b2ced-91fa-40a7-b913-cde380ff90d6", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "DarkGrey", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "metadata": "{\"pskl\":{}}", - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "LightGrey", - "points": [], - "originPoint": { - "name": "origine", - "x": 0, - "y": 0 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 0 - }, - { - "x": 64, - "y": 0 - }, - { - "x": 64, - "y": 64 - }, - { - "x": 0, - "y": 64 - } - ] - ] - } - ] - } - ] - } - ] - }, { "assetStoreId": "871710b14109d14f8528af7a1ec7f3ab039074be8ede00c2b55f8fe8857629b3", "name": "NoButton", @@ -593,85 +434,6 @@ "effects": [], "behaviors": [] }, - { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "Mask", - "persistentUuid": "92c456ec-b30e-4090-b8a4-c4e8c1ae1a32", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [ - { - "name": "ScrollableViewport", - "type": "ScrollableViewport::ScrollableViewport", - "Direction": "Vertical", - "IsDragged": false, - "StartX": 9.788238970689376e-306, - "StartY": 9.788238970694519e-306, - "Layer": "Scrolled", - "TargetedCameraX": 9.788238970694519e-306, - "TargetedCameraY": 9.788238970694519e-306, - "WheeledSpeedX": 9.788238970694519e-306, - "WheeledSpeedY": 9.788238970694519e-306, - "WheelScrollingDuration": 0.25, - "OldCameraX": 0.2500000000002275, - "OldCameraY": 0.2500000000002275 - } - ], - "animations": [ - { - "name": "White", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "metadata": "{\"pskl\":{}}", - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "White", - "points": [], - "originPoint": { - "name": "origine", - "x": 0, - "y": 0 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 0 - }, - { - "x": 64, - "y": 0 - }, - { - "x": 64, - "y": 64 - }, - { - "x": 0, - "y": 64 - } - ] - ] - } - ] - } - ] - } - ] - }, { "assetStoreId": "", "name": "NewScrollableText", @@ -687,7 +449,7 @@ }, { "assetStoreId": "", - "name": "NewScrollableText3", + "name": "NewScrollableText2", "persistentUuid": "5384246b-92ca-40dd-91d8-c2ff3712b229", "type": "ScrollableText::ScrollableText", "variant": "", @@ -703,16 +465,10 @@ "folderName": "__ROOT", "children": [ { - "objectName": "ScrollBar" - }, - { - "objectName": "Text" - }, - { - "objectName": "ContentBackground" + "objectName": "NewScrollableText" }, { - "objectName": "Mask" + "objectName": "NewScrollableText2" }, { "objectName": "YesButton" @@ -725,133 +481,21 @@ }, { "objectName": "WinterBackground" - }, - { - "objectName": "NewScrollableText" - }, - { - "objectName": "NewScrollableText3" } ] }, "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SceneJustBegins" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Scrollbar::Scrollbar::SetContentLength" - }, - "parameters": [ - "ScrollBar", - "=", - "ContentBackground.Height()", - "" - ] - }, - { - "type": { - "value": "SpriteMasking::Mask" - }, - "parameters": [ - "", - "Content", - "Mask", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Scrollbar::Scrollbar::IsThumbDragged" - }, - "parameters": [ - "ScrollBar", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Scrollbar::SetPositionFromCamera" - }, - "parameters": [ - "", - "ScrollBar", - "\"Scrolled\"", - "" - ] - }, - { - "type": { - "value": "ActivateBehavior" - }, - "parameters": [ - "Mask", - "ScrollableViewport", - "yes" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Scrollbar::Scrollbar::IsThumbDragged" - }, - "parameters": [ - "ScrollBar", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "ActivateBehavior" - }, - "parameters": [ - "Mask", - "ScrollableViewport", - "no" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Scrollbar::SetCameraFromPosition" - }, - "parameters": [ - "", - "ScrollBar", - "\"Scrolled\"", - "" - ] - } - ] + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Edit the ScrollableText extension to see how to make a scroll view in your own custom objects." } ], "layers": [