From 3684e9b10e97703ec7356f4db079d0fcb1e55fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Sat, 18 Feb 2023 17:06:02 +0100 Subject: [PATCH] [Slider] Fix slider disappearance when the minimum value is set to 1. --- extensions/reviewed/PanelSpriteSlider.json | 188 ++++++++++++++------- 1 file changed, 126 insertions(+), 62 deletions(-) diff --git a/extensions/reviewed/PanelSpriteSlider.json b/extensions/reviewed/PanelSpriteSlider.json index 1a5ad7ba7..f0baadaa1 100644 --- a/extensions/reviewed/PanelSpriteSlider.json +++ b/extensions/reviewed/PanelSpriteSlider.json @@ -8,7 +8,7 @@ "name": "PanelSpriteSlider", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/UI Essentials/1678c39a3b2bd3df4f82a8a293770db4986a6bcfd3f78e738ddfc86e39176423_UI Essentials_sliders_options.svg", "shortDescription": "A draggable slider that users can move to select a numerical value.", - "version": "1.4.0", + "version": "1.4.1", "description": [ "A draggable slider that users can move to select a numerical value. The slider can be customized with sprites.", "", @@ -221,6 +221,18 @@ "=", "GetArgumentAsNumber(\"Value\")" ] + }, + { + "type": { + "value": "PanelSpriteSlider::Slider::SetValue" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::Value()", + "" + ] } ] } @@ -302,6 +314,18 @@ "=", "GetArgumentAsNumber(\"Value\")" ] + }, + { + "type": { + "value": "PanelSpriteSlider::Slider::SetValue" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::Value()", + "" + ] } ] } @@ -322,11 +346,11 @@ "objectGroups": [] }, { - "description": "Return the bar value bounds size.", + "description": "the bar value bounds size.", "fullName": "Size", - "functionType": "Expression", + "functionType": "ExpressionAndCondition", "name": "Size", - "sentence": "", + "sentence": "the bar value bounds size", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -423,6 +447,18 @@ "=", "GetArgumentAsNumber(\"Value\")" ] + }, + { + "type": { + "value": "PanelSpriteSlider::Slider::SetValue" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::Value()", + "" + ] } ] } @@ -2162,6 +2198,14 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::PropertyShowLabelAtChanges" + }, + "parameters": [ + "Object" + ] + }, { "type": { "value": "CollisionPoint" @@ -3074,78 +3118,98 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "PanelSpriteObject::Width" + "value": "PanelSpriteSlider::Slider::Size" }, "parameters": [ "FillBar", - "=", - "Object.FullBarWidth() * (FillBar.Slider::Value() - FillBar.Slider::MinValue()) / FillBar.Slider::Size()" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetCenterX" - }, - "parameters": [ - "Thumb", - "=", - "Object.FullBarLeft() + FillBar.Width()" - ] - }, - { - "type": { - "value": "SetCenterY" - }, - "parameters": [ - "Thumb", - "=", - "FillBar.CenterY()" + "Slider", + ">", + "0", + "" ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + ], + "actions": [], + "events": [ { - "type": { - "value": "TextObject::String" - }, - "parameters": [ - "Label", - "=", - "ToString(Object.Value())" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PanelSpriteObject::Width" + }, + "parameters": [ + "FillBar", + "=", + "Object.FullBarWidth() * (FillBar.Slider::Value() - FillBar.Slider::MinValue()) / FillBar.Slider::Size()" + ] + } ] }, { - "type": { - "value": "SetCenterX" - }, - "parameters": [ - "Label", - "=", - "Thumb.CenterX()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "Thumb", + "=", + "Object.FullBarLeft() + FillBar.Width()" + ] + }, + { + "type": { + "value": "SetCenterY" + }, + "parameters": [ + "Thumb", + "=", + "FillBar.CenterY()" + ] + } ] }, { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Label", - "=", - "Thumb.Y() - Label.Height() - Object.PropertyLabelMargin()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextObject::String" + }, + "parameters": [ + "Label", + "=", + "ToString(Object.Value())" + ] + }, + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "Label", + "=", + "Thumb.CenterX()" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Label", + "=", + "Thumb.Y() - Label.Height() - Object.PropertyLabelMargin()" + ] + } ] } ]