before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
this.owner.setHeight(bottom - top); } if (this._leftEdgeAnchor !== HorizontalAnchor.None) { this.owner.setX( left + this.owner.getX() - this.owner.getDrawableX() ); } if (this._topEdgeAnchor !== VerticalAnchor.None) { ...
Should we had `if (this.owner.getX() === this.owner.getDrawableX())` to avoid extra computations 90% of the time at the cost of the `if`?
this.owner.setHeight(bottom - top); } if (this._leftEdgeAnchor !== HorizontalAnchor.None) { this.owner.setX( left + this.owner.getX() - this.owner.getDrawableX() ); } if (this._topEdgeAnchor !== VerticalAnchor.None) { ...
@@ -270,8 +270,13 @@ namespace gdjs { this._rightEdgeAnchor !== HorizontalAnchor.None && this._leftEdgeAnchor !== HorizontalAnchor.None ) { - this.owner.setWidth(right - left); - this.owner.setX(left); + const width = right - left; + this....
Extensions/AnchorBehavior/anchorruntimebehavior.ts
26
TypeScript
0.571
question
137
51
51
false
Fix anchor behavior when objects has custom origin
6,970
4ian/GDevelop
10,154
JavaScript
D8H
D8H
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
```suggestion this._customHeight = height; ```
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
@@ -62,6 +62,14 @@ return this._customHeight; } + setWidth(width) { + this._customWidth = width; + } + + setHeight(height) { + return this._customHeight = height;
GDJS/tests/tests/Extensions/testspriteruntimeobject.js
26
JavaScript
0.571
suggestion
51
41
41
false
Fix anchor behavior when objects has custom origin
6,970
4ian/GDevelop
10,154
JavaScript
4ian
D8H
* sub-expression that a given node represents. */ static const gd::String GetType(const gd::Platform &platform, const gd::ProjectScopedContainers &projectScopedContainers, const gd::String &rootType, gd::ExpressionNode& node) { gd::Expression...
This doesn't change anything. It's just to navigate more easily without going through deprecated functions.
* sub-expression that a given node represents. */ static const gd::String GetType(const gd::Platform &platform, const gd::ProjectScopedContainers &projectScopedContainers, const gd::String &rootType, gd::ExpressionNode& node) { gd::Expression...
@@ -72,7 +72,7 @@ class GD_CORE_API ExpressionTypeFinder : public ExpressionParser2NodeWorker { child(nullptr) {}; const gd::String &GetType() { - return gd::ParameterMetadata::GetExpressionValueType(type); + return gd::ValueTypeMetadata::GetExpressionPrimitiveValueType(type);
Core/GDCore/IDE/Events/ExpressionTypeFinder.h
26
C/C++
0.429
suggestion
107
51
51
false
Fix mouse and key parameters for event-functions
7,052
4ian/GDevelop
10,154
JavaScript
D8H
D8H
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
```suggestion return ['intermediate-toggle-states-with-variable']; ```
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
@@ -124,6 +126,8 @@ export const getInstructionTutorialIds = (type: string): Array<string> => { case 'ToggleObjectVariableAsBoolean': case 'ToggleGlobalVariableAsBoolean': case 'ToggleSceneVariableAsBoolean': + case 'SetBooleanObjectVariable': + case 'SetBooleanVariable': return ['iIntermedi...
newIDE/app/src/Utils/GDevelopServices/Tutorial.js
26
JavaScript
0.571
suggestion
78
49
49
false
Add tutorial bubbles on actions replacing deprecated ones
7,077
4ian/GDevelop
10,154
JavaScript
AlexandreSi
D8H
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
`ObjectsContainersList` should be used instead. You can pass a `ProjectScopedContainersAccessor` to your component.
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
@@ -15,3 +15,18 @@ export default function getObjectByName( return null; } + +export const hasObjectWithName = ( + globalObjectsContainer: gdObjectsContainer | null, + objectsContainer?: ?gdObjectsContainer, + objectName: string +): boolean => {
newIDE/app/src/Utils/GetObjectByName.js
23
JavaScript
0.571
suggestion
115
33
18
false
Fix instances paste from a scene to another
7,105
4ian/GDevelop
10,154
JavaScript
D8H
AlexandreSi
> <QuickPublish project={testProject.project} gameAndBuildsManager={fakeEmptyGameAndBuildsManager} isSavingProject={false} isRequiredToSaveAsNewCloudProject={() => // Indicates that the project is already saved, there will be // no need to sa...
I feel like this comment should be next to the props type in QuickPublish. I was not sure what it meant before reading this comment
onClose={action('onClose')} onContinueQuickCustomization={action('onContinueQuickCustomization')} onTryAnotherGame={action('onTryAnotherGame')} /> </AuthenticatedUserContext.Provider> </Template> ); }; export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAl...
@@ -119,6 +124,39 @@ export const AuthenticatedWithTooManyCloudProjects = () => { </Template> ); }; + +export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAlready = () => { + return ( + <Template> + <AuthenticatedUserContext.Provider + value={{ + ...fakeAuthenticatedUserWi...
newIDE/app/src/stories/componentStories/QuickCustomization/QuickPublish.stories.js
26
JavaScript
0.571
suggestion
131
51
51
false
Fix issues when reworking a quick customization project
7,109
4ian/GDevelop
10,154
JavaScript
AlexandreSi
4ian
if (!selectedItem) return; if (selectedItem.content.isDescendantOf(item.content)) { selectObjectFolderOrObjectWithContext(null); } }, [selectObjectFolderOrObjectWithContext, selectedItems] ); // Force List component to be mounted again if project or objectsContaine...
Removing the column, you removed the margin, you should maybe remove the `noMargin` in the child Column
* does not stay selected and not visible to the user. */ const onCollapseItem = React.useCallback( (item: TreeViewItem) => { if (!selectedItems || selectedItems.length !== 1) return; const selectedItem = selectedItems[0]; if (!selectedItem) return; if (selectedItem.co...
@@ -1363,28 +1393,16 @@ const ObjectsList = React.forwardRef<Props, ObjectsListInterface>( return ( <Background maxWidth> - <Column>
newIDE/app/src/ObjectsList/index.js
26
JavaScript
0.571
suggestion
103
51
51
false
Replace the "add folder" button by a drop-down menu action
7,117
4ian/GDevelop
10,154
JavaScript
AlexandreSi
D8H
this._injectExternalLayout ); this._watermark.displayAtStartup(); //Uncomment to profile the first x frames of the game. // var x = 500; // var startTime = Date.now(); // console.profile("Stepping for " + x + " frames") // for(var i = 0; i < x; ++i) { ...
This check should not exist, you should stop gameLoop before disposing of the renderer.
? firstSceneName : // There is always at least a scene this.getSceneAndExtensionsData()!.sceneData.name; } /** * Start the game loop, to be called once assets are loaded. */ startGameLoop() { this._throwIfDisposed(); try { if (!this.hasScene()) { ...
@@ -888,6 +889,10 @@ namespace gdjs { this._hasJustResumed = false; this._renderer.startGameLoop((lastCallElapsedTime) => { try { + if (this._isDisposed) { + return false; + }
GDJS/Runtime/runtimegame.ts
26
TypeScript
0.286
suggestion
87
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
? !!navigator.maxTouchPoints && navigator.maxTouchPoints > 2 : false, supportedCompressionMethods: getSupportedCompressionMethods(), }; }; _setupGameVisibilityEvents() { if (typeof navigator !== 'undefined' && typeof document !== 'undefined') { document.addEv...
Remove this check, and clear the interval instead.
enableMetrics(enable: boolean): void { this._disableMetrics = !enable; if (enable) { this._setupSessionMetrics(); } } /** * Helper function to get information about the platform running the game. */ getPlatformInfo = () => { return { // @ts-ignore ...
@@ -989,6 +1005,10 @@ namespace gdjs { * time. */ _setupSessionMetrics() { + if (this._isDisposed) { + return; + }
GDJS/Runtime/runtimegame.ts
26
TypeScript
0.286
refactor
50
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
} catch (e) { if (this._debuggerClient) this._debuggerClient.onUncaughtException(e); throw e; } }); setTimeout(() => { this._setupSessionMetrics(); }, 4000); } catch (e) { if (this._debuggerClient) this._debuggerC...
What is the aim of this check? Calling the dispose method once is the responsibility of whoever created the game.
const elapsedTime = accumulatedElapsedTime; accumulatedElapsedTime = 0; // Manage resize events. if (this._notifyScenesForGameResolutionResize) { this._sceneStack.onGameResolutionResized(); this._notifyScenesForGameResolutionResize = false; ...
@@ -937,6 +942,17 @@ namespace gdjs { } } + dispose(): void { + if (this._isDisposed) { + return; + } + + this._isDisposed = true;
GDJS/Runtime/runtimegame.ts
26
TypeScript
0.357
question
113
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
newScene.networkId = sceneSyncData.networkId; } hasMadeChangeToStack = true; // Continue to the next scene in the stack received from the host. continue; } // The scene is in the stack and has the right networkId. // Nothing to do, just contin...
Use `for...of` or `forEach` because there is no logic with `i` involved.
debugLogger.info( `Scene at position ${i} and name ${sceneAtThisPositionInOurStack.getName()} has a different networkId ${ sceneAtThisPositionInOurStack.networkId } than the expected ${sceneSyncData.networkId}, replacing.` ); // The scene is in the sta...
@@ -354,5 +354,12 @@ namespace gdjs { return hasMadeChangeToStack; } + + dispose(): void { + for (let i = 0; i < this._stack.length; ++i) { + this._stack[i].unloadScene(); + }
GDJS/Runtime/scenestack.ts
26
TypeScript
0.429
suggestion
72
31
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
logger.error('Window closing failed. See error:', error); } } } else { if ( typeof navigator !== 'undefined' && // @ts-ignore navigator.app && // @ts-ignore navigator.app.exitApp ) { // @ts-ignore n...
Call `this._threeRenderer?.dispose();`.
} /** * Close the game, if applicable. */ stopGame() { // Try to detect the environment to use the most adapted // way of closing the app const remote = this.getElectronRemote(); if (remote) { const browserWindow = remote.getCurrentWindow(); if (browserWind...
@@ -924,6 +924,14 @@ namespace gdjs { // HTML5 games on mobile/browsers don't have a way to close their window/page. } + dispose() { + this._pixiRenderer?.destroy(true); + this._pixiRenderer = null; + this._threeRenderer = null;
GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
26
TypeScript
0.214
suggestion
39
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
} } } else { if ( typeof navigator !== 'undefined' && // @ts-ignore navigator.app && // @ts-ignore navigator.app.exitApp ) { // @ts-ignore navigator.app.exitApp(); } } // HTML5 games on mobi...
Remove gameCanvas and domElementsContainer from the parent element.
/** * Close the game, if applicable. */ stopGame() { // Try to detect the environment to use the most adapted // way of closing the app const remote = this.getElectronRemote(); if (remote) { const browserWindow = remote.getCurrentWindow(); if (browserWindow) { ...
@@ -924,6 +924,14 @@ namespace gdjs { // HTML5 games on mobile/browsers don't have a way to close their window/page. } + dispose() { + this._pixiRenderer?.destroy(true); + this._pixiRenderer = null; + this._threeRenderer = null; + this._gameCanvas = null;
GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
26
TypeScript
0.286
suggestion
67
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
/* * GDevelop JS Platform * Copyright 2013-2023 Florian Rival (Florian.Rival@gmail.com). All rights reserved. * This project is released under the MIT License. */ namespace gdjs { /** * A resource managers that download and remember downloaded content for one * kind of resource. */ export interface Res...
Please, add jsdoc description.
/** * Load the specified resource. * * This method will be run during the game. It should only do light tasks * like file downloading. */ loadResource(resourceName: string): Promise<void>; /** * Process the specified resource. * * This method will only be run while l...
@@ -29,5 +29,7 @@ namespace gdjs { * Return the kind of resources handled by this manager. */ getResourceKinds(): Array<ResourceKind>; + + dispose(): void;
GDJS/Runtime/ResourceManager.ts
26
TypeScript
0.071
suggestion
30
36
29
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
xhr.send(); } /** * Check if the given json resource was loaded (preloaded or loaded with `loadJson`). * @param resourceName The name of the json resource. * @returns true if the content of the json resource is loaded. false otherwise. */ isJsonLoaded(resourceName: string): boolea...
Do not forget to call the function.
xhr.send(); } /** * Check if the given json resource was loaded (preloaded or loaded with `loadJson`). * @param resourceName The name of the json resource. * @returns true if the content of the json resource is loaded. false otherwise. */ isJsonLoaded(resourceName: string): boolea...
@@ -200,5 +200,10 @@ namespace gdjs { getLoadedJson(resourceName: string): Object | null { return this._loadedJsons.getFromName(resourceName) || null; } + + dispose(): void { + this._loadedJsons.clear(); + this._callbacks.clear
GDJS/Runtime/jsonmanager.ts
26
TypeScript
0.071
suggestion
35
30
34
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
'include' : // For other resources, use "same-origin" as done by default by fetch. 'same-origin', } ); const fontData = await response.text(); this._loadedFontsData.set(resource, fontData); } catch (error) { logger.error( ...
Might be: `this._pixiBitmapFontsToUninstall.length = 0;`
'include' : // For other resources, use "same-origin" as done by default by fetch. 'same-origin', } ); const fontData = await response.text(); this._loadedFontsData.set(resource, fontData); } catch (error) { logger.error( ...
@@ -289,6 +289,18 @@ namespace gdjs { ); } } + + dispose(): void { + for (const bitmapFontInstallKey in this._pixiBitmapFontsInUse) { + PIXI.BitmapFont.uninstall(bitmapFontInstallKey); + } + for (const bitmapFontInstallKey of this._pixiBitmapFontsToUninstall) { + ...
GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts
26
TypeScript
0.357
suggestion
56
35
41
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); for (const threeTexture of threeTextures) { threeTexture.dispose(); } const threeMaterials: THREE.Material[] = ...
Will this work? ``` for (const pixiTexture of this._diskTextures.values()) { if (pixiTexture.destroyed) { continue; } pixiTexture.destroy(); } this._diskTextures.clear(); ``` Minus new array creation.
* To be called when the game is disposed. * Clear caches of loaded textures and materials. */ dispose(): void { this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); f...
@@ -463,6 +463,54 @@ namespace gdjs { } return particleTexture; } + + dispose(): void { + this._loadedTextures.clear(); + + const threeTextures: THREE.Texture[] = []; + this._loadedThreeTextures.values(threeTextures); + this._loadedThreeTextures.clear(); + for (const three...
GDJS/Runtime/pixi-renderers/pixi-image-manager.ts
26
TypeScript
0.786
suggestion
262
51
51
false
Add dispose method to Runtimegame
7,118
4ian/GDevelop
10,154
JavaScript
malec-palec
danvervlad
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer &GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
These are not references/pointers but values, meaning that ProjectScopedContainers moved from "I'm just a set of lists pointing to things in your project" to "I actually hold stuff, and you will have a bad time if you destroyed me and kept references to things".
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer *GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
@@ -236,6 +230,8 @@ class ProjectScopedContainers { private: gd::ObjectsContainersList objectsContainersList; gd::VariablesContainersList variablesContainersList; + gd::VariablesContainer legacyGlobalVariables; + gd::VariablesContainer legacySceneVariables;
Core/GDCore/Project/ProjectScopedContainers.h
26
C/C++
0.5
suggestion
262
31
31
false
Allow legacy scene variable parameters to use extension variables
7,121
4ian/GDevelop
10,154
JavaScript
4ian
D8H
auto &initialInstances = eventsBasedObject.GetInitialInstances(); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialIn...
The previous description better fit what the test actually covers.
auto &initialInstances = eventsBasedObject.GetInitialInstances(); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialInstance().SetLayer("My layer"); initialInstances.InsertNewInitialIn...
@@ -4452,13 +4452,13 @@ TEST_CASE("MergeLayers", "[common]") { REQUIRE(initialInstances.GetLayerInstancesCount("My other layer") == 1); } - SECTION("Can rename a leaderboard in scene events") { + SECTION("Can find and rename leaderboards in a project") {
Core/tests/WholeProjectRefactorer.cpp
26
C++
0.286
suggestion
66
51
51
false
Fix leaderboards not properly replaced in projects using them in custom objects
7,131
4ian/GDevelop
10,154
JavaScript
D8H
4ian
} onInstructionTypeChanged={onInstructionTypeChanged} /> {editorOpen && project && !objectGroup && ( <ObjectVariablesDialog project={project} projectScopedContainersAccessor={projectScopedContainersAccessor} objectName={objectName} ...
Sounds suspicious as not used then?
} onInstructionTypeChanged={onInstructionTypeChanged} /> {editorOpen && project && !!variablesContainers.length && !objectGroup && ( <ObjectVariablesDialog project={project} projectScopedContainersAccessor={project...
@@ -188,37 +188,43 @@ export default React.forwardRef<ParameterFieldProps, ParameterFieldInterface>( } onInstructionTypeChanged={onInstructionTypeChanged} /> - {editorOpen && project && !objectGroup && ( - <ObjectVariablesDialog - project={project} - ...
newIDE/app/src/EventsSheet/ParameterFields/ObjectVariableField.js
26
JavaScript
0.143
question
35
43
49
false
Prevent opening variables dialog for objects & groups if there is no object
7,132
4ian/GDevelop
10,154
JavaScript
4ian
ClementPasteau
// We could pass it a string, but lets do it right this.removeJoint(parseInt(jId, 10)); } } } } // Remove the joint this.world.DestroyJoint(joint); delete this.joints[jointId]; } } } gdjs.registerRuntimeSc...
In the future, a `destroy()` method on the shared data would be I think safer (in the sense: it's part of the class, so there is less chance you forget to update it when needed) and we we should probably made the "shared data" something first class that is handled by the runtime scene (rather than something that is man...
if ( this.joints[jId].GetType() === Box2D.e_gearJoint && (Box2D.getPointer( (this.joints[jId] as Box2D.b2GearJoint).GetJoint1() ) === Box2D.getPointer(joint) || Box2D.getPointer( (this.joints[jId] as Bo...
@@ -300,14 +309,11 @@ namespace gdjs { } } gdjs.registerRuntimeSceneUnloadedCallback(function (runtimeScene) { - if ( - // @ts-ignore - runtimeScene.physics2SharedData && - // @ts-ignore - runtimeScene.physics2SharedData.world - ) { - // @ts-ignore - Box2D.destroy(runtimeS...
Extensions/Physics2Behavior/physics2runtimebehavior.ts
26
TypeScript
0.786
suggestion
360
51
51
false
[Physics2] Fix a memory leak on object instances
7,136
4ian/GDevelop
10,154
JavaScript
4ian
D8H
// we need to relay the ownership change to others, // and expect an acknowledgment from them. if (gdjs.multiplayer.isCurrentPlayerHost()) { const connectedPeerIds = gdjs.multiplayerPeerJsHelper.getAllPeers(); // We don't need to send the message to the player who s...
So this was sending too many messages!
// we need to relay the ownership change to others, // and expect an acknowledgment from them. if (gdjs.multiplayer.isCurrentPlayerHost()) { const connectedPeerIds = gdjs.multiplayerPeerJsHelper.getAllPeers(); // We don't need to send the message to the player who s...
@@ -917,12 +917,12 @@ namespace gdjs { // As we are the host, we do not cancel the message if it times out. shouldCancelMessageIfTimesOut: false, }); - for (const peerId of otherPeerIds) { - debugLogger.info( - `Relaying ownership change ...
Extensions/Multiplayer/messageManager.ts
26
TypeScript
0.071
suggestion
38
51
51
false
Fix destroying an object even if flagged as "DoNothing" in the multiplayer behavior
7,137
4ian/GDevelop
10,154
JavaScript
4ian
ClementPasteau
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
this seemed duplicated in this file and the browser one. This was always causing an error in the console because the signal always aborts (we trigger it when we close the dialog) I don't think this deserves to raise an error as it's the expected path?
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
@@ -61,11 +61,6 @@ class LocalLoginProvider implements LoginProvider, FirebaseBasedLoginProvider { if (signal) { signal.addEventListener('abort', () => { terminateWebSocket(); - reject(
newIDE/app/src/LoginProvider/LocalLoginProvider.js
26
JavaScript
0.643
refactor
253
51
51
false
Fix infinite loading when canceling login with provider
7,138
4ian/GDevelop
10,154
JavaScript
ClementPasteau
ClementPasteau
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
I don't like doing this here. It looks like we're trying to "finish a process". But the process is already there: <img width="776" alt="image" src="https://github.com/user-attachments/assets/6fe5b8b4-8d4c-4124-b83a-34f6d90bbd83"> There is already a catch (ensuring that an exception will never stop the end to run)...
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
@@ -996,11 +996,19 @@ export default class AuthenticatedUserProvider extends React.Component< this._automaticallyUpdateUserProfile = true; }; - _cancelLogin = () => { + _cancelLoginOrSignUp = () => { if (this._abortController) { this._abortController.abort(); this._abortController = null;...
newIDE/app/src/Profile/AuthenticatedUserProvider.js
26
JavaScript
0.643
suggestion
369
51
51
false
Fix infinite loading when canceling login with provider
7,138
4ian/GDevelop
10,154
JavaScript
4ian
ClementPasteau
Props, State > { state = { eventsFunction: null, extensionName: '', createNewExtension: false, }; _projectScopedContainersAccessor: ProjectScopedContainersAccessor | null = null; componentDidMount() { const { project, scope, globalObjectsContainer, objectsContainer, ...
This is kind of regression as it will forbid to use the same name as global variables and global objects for a parameter. We should probably use a new blank project instead.
Props, State > { state = { eventsFunction: null, extensionName: '', createNewExtension: false, }; _projectScopedContainersAccessor: ProjectScopedContainersAccessor | null = null; componentDidMount() { const { project, scope, globalObjectsContainer, objectsContainer, ...
@@ -65,6 +67,12 @@ export default class EventsFunctionExtractorDialog extends React.Component< serializedEvents, } = this.props; + // This is only used to check parameter for name conflict. + // TODO Update it according to the chosen extension. + this._projectScopedContainersAccessor = new Projec...
newIDE/app/src/EventsSheet/EventsFunctionExtractor/EventsFunctionExtractorDialog.js
26
JavaScript
0.429
suggestion
174
51
51
false
Reduce the risk of name collisions between objects, variables, parameters and properties
7,148
4ian/GDevelop
10,154
JavaScript
D8H
D8H
preferences.values.openDiagnosticReportAutomatically, onLaunchPreviewWithDiagnosticReport, previewState.overridenPreviewLayoutName, previewState.overridenPreviewExternalLayoutName, previewState.isPreviewOverriden, previewState.previewExternalLayoutName, previewSta...
wondering if we should also take a screenshot only if: - you don't have a thumbnailUrl already set (but the screenshots might be useful) - you haven't taken a screenshot recently (to avoid taking one on every preview) - like every x minutes ?
previewState.overridenPreviewLayoutName, previewState.overridenPreviewExternalLayoutName, previewState.isPreviewOverriden, previewState.previewExternalLayoutName, previewState.previewLayoutName, setPreviewOverride, ] ); // Create a separate function to avoi...
@@ -185,7 +187,11 @@ const PreviewAndShareButtons = React.memo<PreviewAndShareButtonsProps>( <LineStackLayout noMargin> <FlatButtonWithSplitMenu primary - onClick={onHotReloadPreview} + onClick={ + !hasPreviewsRunning && preferences.values.takeScreenshotOnPreview ...
newIDE/app/src/MainFrame/Toolbar/PreviewAndShareButtons.js
26
JavaScript
0.5
question
244
51
51
false
Take a screenshot on preview
7,156
4ian/GDevelop
10,154
JavaScript
ClementPasteau
ClementPasteau
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
Consider not adding yet-another-way-to-launch-preview and instead: - Make the logic related to the timing inside the existing function. - delayTimeInSeconds can also be in the function - forcing a screenshot, bypassing the check for timing, is "just" a "forceScreenshot: true". But this is only used for quick customi...
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
@@ -1723,13 +1724,31 @@ const MainFrame = (props: Props) => { const launchNewPreview = React.useCallback( async options => { const numberOfWindows = options ? options.numberOfWindows : 1; - launchPreview({ networkPreview: false, numberOfWindows }); + await launchPreview({ networkPreview: false,...
newIDE/app/src/MainFrame/index.js
26
JavaScript
0.5
suggestion
375
51
51
false
Take a screenshot on preview
7,156
4ian/GDevelop
10,154
JavaScript
4ian
ClementPasteau
// (because the target is in the scope), replace or remove it: RenameOrRemovePropertyOfTargetPropertyContainer(node.name); } if (node.child) node.child->Visit(*this); }); } void OnVisitVariableAccessorNode(VariableAccessorNode& node) override { if (node.child) node.chi...
I don't understand why this "MatchIdentifierWithName" is not doing its job? If it's a variable, it should match it (and so do nothing), no?
}, [&]() { // Do nothing, it's something else. if (node.child) node.child->Visit(*this); }); } void OnVisitVariableAccessorNode(VariableAccessorNode& node) override { if (node.child) node.child->Visit(*this); } void OnVisitVariableBracketAccessorNode( VariableBracketAccesso...
@@ -118,17 +116,24 @@ class GD_CORE_API ExpressionPropertyReplacer } void OnVisitVariableBracketAccessorNode( VariableBracketAccessorNode& node) override { + bool isGrandParentTypeAVariable = isParentTypeAVariable; + isParentTypeAVariable = false; node.expression->Visit(*this); + isParentType...
Core/GDCore/IDE/Events/EventsPropertyReplacer.cpp
26
C++
0.429
question
139
51
51
false
Fix variables from being renamed with a property
7,186
4ian/GDevelop
10,154
JavaScript
4ian
D8H
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
to make it a bit shorter ```suggestion SetDefaultCameraBehavior(element.GetStringAttribute("defaultCameraBehavior", "top-left-anchored-if-never-moved")); ```
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
@@ -80,6 +84,7 @@ void Layer::UnserializeFrom(const SerializerElement& element) { SetName(element.GetStringAttribute("name", "", "Name")); SetRenderingType(element.GetStringAttribute("renderingType", "")); SetCameraType(element.GetStringAttribute("cameraType", "perspective")); + SetDefaultCameraBehavior(el...
Core/GDCore/Project/Layer.cpp
26
C++
0.786
suggestion
164
51
51
false
Fix anchor behavior and add option to center layer or keep top-left fixed when resized
7,188
4ian/GDevelop
10,154
JavaScript
D8H
4ian
_cameraX: float; _cameraY: float; _cameraZ: float = 0; /** * `_cameraZ` is dirty when the zoom factor is set last. */ _isCameraZDirty: boolean = true; /** * @param layerData The data used to initialize the layer * @param instanceContainer The container in which the layer is ...
Should this use `getViewportOriginX/Y` to handle the fact that custom objects don't necessarily have the top-left corner at (0 ; 0) (even if it probably doesn't matter here as it's a scene layer)?
_cameraX: float; _cameraY: float; _cameraZ: float = 0; /** * `_cameraZ` is dirty when the zoom factor is set last. */ _isCameraZDirty: boolean = true; /** * @param layerData The data used to initialize the layer * @param instanceContainer The container in which the layer is ...
@@ -28,8 +28,25 @@ namespace gdjs { ) { super(layerData, instanceContainer); - this._cameraX = this.getWidth() / 2; - this._cameraY = this.getHeight() / 2; + if ( + this._defaultCameraBehavior === + gdjs.RuntimeLayerDefaultCameraBehavior + .KEEP_TOP_LEFT_FIXED_IF_NEVE...
GDJS/Runtime/layer.ts
26
TypeScript
0.714
question
196
51
51
false
Fix anchor behavior and add option to center layer or keep top-left fixed when resized
7,188
4ian/GDevelop
10,154
JavaScript
D8H
4ian
// Handle scale mode. if (this._game.getScaleMode() === 'nearest') { gameCanvas.style['image-rendering'] = '-moz-crisp-edges'; gameCanvas.style['image-rendering'] = '-webkit-optimize-contrast'; gameCanvas.style['image-rendering'] = '-webkit-crisp-edges'; gameCanvas.style['im...
There is a lot of copy from the `createStandardCanvas` function. Could you rework `createStandardCanvas` so that it's using `useCanvas` under the hood? Also, the name is probably not showing this is an important operation enough, that just can't be redone a second time. So I think it should be called `initializeForC...
// Prevent magnifying glass on iOS with a long press. // Note that there are related bugs on iOS 15 (see https://bugs.webkit.org/show_bug.cgi?id=231161) // but it seems not to affect us as the `domElementsContainer` has `pointerEvents` set to `none`. domElementsContainer.style['-webkit-user-sel...
@@ -189,6 +189,120 @@ namespace gdjs { gameCanvas.focus(); } + useCanvas(gameCanvas: HTMLCanvasElement): void {
GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
26
TypeScript
0.643
suggestion
326
51
51
false
Add external canvas usage to RuntimeGamePixiRenderer
7,199
4ian/GDevelop
10,154
JavaScript
4ian
danvervlad
} else { outputObjectsContainer.InsertNewObject( project, parameter.GetExtraInfo(), objectName, outputObjectsContainer.GetObjectsCount()); } // Memorize the last object name. By convention, parameters that require // an object (mainly, "ob...
I wonder if the name can be confusing because a free function could have an object parameter without object type and the following behavior parameters be some capabilities (default behavior). It also won't be "all" the behaviors of the actual objects. I guess it's kind of the required behavior for objects passed in pa...
// are all present (and no more than required by the object type). // Non default behaviors coming from parameters will be added or removed later. project.EnsureObjectDefaultBehaviors(outputObjectsContainer.GetObject(objectName)); } else { // Create a new object (and its default be...
@@ -71,7 +75,7 @@ void ParameterMetadataTools::ParametersToObjectsContainer( const gd::String& behaviorType = parameter.GetExtraInfo(); gd::Object& object = outputObjectsContainer.GetObject(lastObjectName); - allObjectBehaviorNames[lastObjectName].insert(behaviorName); + allObj...
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
26
C++
1
suggestion
510
51
51
false
Fix default behaviors not added properly to objects in functions
7,206
4ian/GDevelop
10,154
JavaScript
D8H
4ian
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(gd.ObjectsContainer.Function); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ...
Maybe `ObjectMetadata::AddDefaultBehavior` can be used to simulate a change of capability in a custom object.
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ); // Check that obje...
@@ -4295,19 +4295,37 @@ describe('libGD.js', function () { expect(objectsContainer.hasObjectNamed('MyObjectWithoutType')).toBe(true); expect(objectsContainer.hasObjectNamed('MySpriteObject')).toBe(true); - const objectWithoutType = objectsContainer.getObject('MyObjectWithoutType'); - expect(ob...
GDevelop.js/__tests__/Core.js
26
JavaScript
0.571
suggestion
109
51
51
false
Fix default behaviors not added properly to objects in functions
7,206
4ian/GDevelop
10,154
JavaScript
D8H
4ian
std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContainer.RemoveObject(objectName); } } // Remove behaviors of object...
Actually, I think it's legit to add behavior parameters to require capabilities on an object without any specified type.
} } // Remove objects that are not in the parameters anymore. std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContain...
@@ -108,8 +112,14 @@ void ParameterMetadataTools::ParametersToObjectsContainer( } auto& object = outputObjectsContainer.GetObject(objectName); + const auto& allBehaviorNames = allObjectNonDefaultBehaviorNames[objectName]; for (const auto& behaviorName : object.GetAllBehaviorNames()) { - const a...
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
26
C++
0.5
suggestion
120
51
51
false
Fix default behaviors not added properly to objects in functions
7,206
4ian/GDevelop
10,154
JavaScript
D8H
4ian
behavior->SetDefaultBehavior(true); }; auto &objectMetadata = gd::MetadataProvider::GetObjectMetadata(platform, objectType); if (!MetadataProvider::IsBadObjectMetadata(objectMetadata)) { for (auto &behaviorType : objectMetadata.GetDefaultBehaviors()) { addDefaultBehavior(behaviorType);...
It's probably not a big issue, but instance stability won't be ensured for capabilities required for an object without any type. Unless capabilities from parameters are not marked as default behavior?
const auto& behavior = object.GetBehavior(behaviorName); if (!behavior.IsDefaultBehavior() || behavior.GetTypeName() != behaviorType) { // Behavior type has changed, remove it so it is re-created. object.RemoveBehavior(behaviorName); } } if (!object.HasBehaviorNamed(b...
@@ -97,24 +95,62 @@ std::unique_ptr<gd::Object> Project::CreateObject( " has an unknown default behavior: " + behaviorType); return; } - auto* behavior = object->AddNewBehavior( - project, behaviorType, behaviorMetadata.GetDefaultName()); - behavior->SetDefaultBehavio...
Core/GDCore/Project/Project.cpp
26
C++
0.571
question
201
51
51
false
Fix default behaviors not added properly to objects in functions
7,206
4ian/GDevelop
10,154
JavaScript
D8H
4ian
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
I'd rather say `Your project must be stored on your computer` rather than surely, it feels more english
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
@@ -50,13 +51,37 @@ import PreferencesContext from '../MainFrame/Preferences/PreferencesContext'; import { textEllipsisStyle } from '../UI/TextEllipsis'; import FileWithLines from '../UI/CustomSvgIcons/FileWithLines'; import TextButton from '../UI/TextButton'; -import { Tooltip } from '@material-ui/core'; +import { ...
newIDE/app/src/GameDashboard/GameDashboardCard.js
26
JavaScript
0.5
suggestion
103
51
51
false
Polishing the new Create tab
7,236
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
export const getDetailedProjectDisplayDate = (i18n: I18nType, date: number) => i18n.date(date, { dateStyle: 'short', timeStyle: 'short', }); const getNoProjectAlertMessage = () => { if (!electron) { // Trying to open a local project from the web app of the mobile app. return t`Looks like your pro...
maybe double check landscape/mobile/etc...
export const getDetailedProjectDisplayDate = (i18n: I18nType, date: number) => i18n.date(date, { dateStyle: 'short', timeStyle: 'short', }); const getNoProjectAlertMessage = () => { if (!electron) { // Trying to open a local project from the web app of the mobile app. return t`Looks like your pro...
@@ -67,7 +92,7 @@ const styles = { display: 'flex', flexShrink: 0, flexDirection: 'column', - justifyContent: 'flex-end', + justifyContent: 'center',
newIDE/app/src/GameDashboard/GameDashboardCard.js
26
JavaScript
0.071
suggestion
43
51
51
false
Polishing the new Create tab
7,236
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
newSaveAsOptions = saveAsOptions; } if (canFileMetadataBeSafelySavedAs && currentFileMetadata) { const canProjectBeSafelySavedAs = await canFileMetadataBeSafelySavedAs( currentFileMetadata, { showAlert, showConfirmation, ...
just double checking this will not affect the initial project? I assume not as we're not saving that project
// ... or if the project is opened from a URL. oldStorageProvider.internalName !== 'UrlStorageProvider', }); if (!saveAsLocation) { return; // Save as was cancelled. } newSaveAsLocation = saveAsLocation; newSaveAsOptions = saveAsO...
@@ -2627,6 +2633,21 @@ const MainFrame = (props: Props) => { if (!canProjectBeSafelySavedAs) return; } + let originalProjectUuid = null; + if (newSaveAsOptions && newSaveAsOptions.generateNewProjectUuid) { + originalProjectUuid = currentProject.getProjectUuid(); + c...
newIDE/app/src/MainFrame/index.js
26
JavaScript
0.357
suggestion
109
51
51
false
When duplicating a project, ask for the new name and if link with game should be kept
7,253
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
|}) => async ({ project, fileMetadata, }: {| project: gdProject, fileMetadata: ?FileMetadata, |}): Promise<{| saveAsLocation: ?SaveAsLocation, saveAsOptions: ?SaveAsOptions, |}> => { if (!authenticatedUser.authenticated) { return { saveAsLocation: null, saveAsOptions: null }; } const options = aw...
maybe name this prop `shouldAskForNewProjectUuid` to be consistent with the props you use in the component?
|}) => async ({ project, fileMetadata, displayOptionToGenerateNewProjectUuid, }: {| project: gdProject, fileMetadata: ?FileMetadata, displayOptionToGenerateNewProjectUuid: boolean, |}): Promise<{| saveAsLocation: ?SaveAsLocation, saveAsOptions: ?SaveAsOptions, |}> => { if (!authenticatedUser.authentic...
@@ -189,33 +190,40 @@ export const generateOnChooseSaveProjectAsLocation = ({ fileMetadata: ?FileMetadata, |}): Promise<{| saveAsLocation: ?SaveAsLocation, + saveAsOptions: ?SaveAsOptions, |}> => { if (!authenticatedUser.authenticated) { - return { saveAsLocation: null }; + return { saveAsLocation: nu...
newIDE/app/src/ProjectsStorage/CloudStorageProvider/CloudProjectWriter.js
26
JavaScript
0.571
question
107
51
51
false
When duplicating a project, ask for the new name and if link with game should be kept
7,253
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
return { saveAsLocation: { name: options.name, }, saveAsOptions: { generateNewProjectUuid: options.generateNewProjectUuid, }, }; }; export const generateOnSaveProjectAs = ( authenticatedUser: AuthenticatedUser, setDialog: (() => React.Node) => void, closeDialog: () => void ) => as...
why this change? was this not used?
}); if (!options) return { saveAsLocation: null, saveAsOptions: null }; // Save was cancelled. return { saveAsLocation: { name: options.name, }, saveAsOptions: { generateNewProjectUuid: options.generateNewProjectUuid, }, }; }; export const generateOnSaveProjectAs = ( authenticat...
@@ -243,7 +251,7 @@ export const generateOnSaveProjectAs = ( } options.onStartSaving(); - const gameId = saveAsLocation.gameId || project.getProjectUuid();
newIDE/app/src/ProjectsStorage/CloudStorageProvider/CloudProjectWriter.js
26
JavaScript
0.143
question
35
51
51
false
When duplicating a project, ask for the new name and if link with game should be kept
7,253
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
|}> => { const options = await new Promise(resolve => { setDialog(() => ( <SaveAsOptionsDialog onCancel={() => { closeDialog(); resolve(null); }} nameSuggestion={ fileMetadata ? `${project.getName()} - Copy` : project.getName() } mainActi...
any risk the `options.name` results in a filename that is not compatible with path? like with '/' in it?
saveAsLocation: ?SaveAsLocation, // This is the newly chosen location (or null if cancelled). saveAsOptions: ?SaveAsOptions, |}> => { const options = await new Promise(resolve => { setDialog(() => ( <SaveAsOptionsDialog onCancel={() => { closeDialog(); resolve(null); ...
@@ -180,16 +185,49 @@ export const onSaveProject = async ( }; }; -export const onChooseSaveProjectAsLocation = async ({ +export const generateOnChooseSaveProjectAsLocation = ({ + setDialog, + closeDialog, +}: { + setDialog: (() => React.Node) => void, + closeDialog: () => void, +}) => async ({ project, ...
newIDE/app/src/ProjectsStorage/LocalFileStorageProvider/LocalProjectWriter.js
26
JavaScript
0.5
question
104
51
51
false
When duplicating a project, ask for the new name and if link with game should be kept
7,253
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
) : ( <Text> <Trans>You don't have any feedback for this game.</Trans> </Text> )} </> )} {displayedFeedbacksArray.length !== 0 && ( <ColumnStackLayout expand noMa...
I don't think that's useful, let's not do it
value={''} label={t`All exports`} /> <SelectOption key={'game-only'} value={'game-only'} label={t`On game page only`} ...
@@ -374,89 +419,154 @@ const GameFeedback = ({ i18n, authenticatedUser, game }: Props) => { </ResponsiveLineStackLayout> <ColumnStackLayout expand noMargin> {!!feedbacks && feedbacks.length > 0 && ( + // TODO: Should it display the data for the filtered pi...
newIDE/app/src/GameDashboard/Feedbacks/GameFeedback.js
26
JavaScript
0.143
suggestion
44
51
51
false
Paginate feedbacks
7,259
4ian/GDevelop
10,154
JavaScript
4ian
AlexandreSi
// - The normal keeps the same length (as the normal is included in the 2D space) this._slopeClimbingMinNormalZ = Math.min( Math.cos(gdjs.toRad(slopeMaxAngle)), 1 - 1 / 1024 ); } getStairHeightMax(): float { return this._stairHeightMax; } setStairHeightMax(stair...
Is there an explanation for those factors?
// - The normal keeps the same length (as the normal is included in the 2D space) this._slopeClimbingMinNormalZ = Math.min( Math.cos(gdjs.toRad(slopeMaxAngle)), 1 - 1 / 1024 ); } getStairHeightMax(): float { return this._stairHeightMax; } setStairHeightMax(stair...
@@ -783,6 +791,27 @@ namespace gdjs { ); } + getStairHeightMax(): float { + return this._stairHeightMax; + } + + setStairHeightMax(stairHeightMax: float): void { + const { extendedUpdateSettings } = this.getPhysics3D(); + this._stairHeightMax = stairHeightMax; + console.log(st...
Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.ts
26
TypeScript
0.071
question
42
51
51
false
Add a property to choose the maximum stair height a 3D character can walk
7,265
4ian/GDevelop
10,154
JavaScript
AlexandreSi
D8H
}); if (output.code !== 0) { shell.exit(0); } }); // Copy the GDJS runtime and extension sources (used for autocompletions // in the IDE). This is optional as this takes a lot of time that would add // up whenever any change is made. if (!args['skip-sources']) { shell.echo( `ℹ️ Copying GDJS and extensi...
Should `pixi` and `three` be a sub-folders of `libs`?
cwd: path.join(gdevelopRootPath, 'GDJS'), }); if (output.code !== 0) { shell.exit(0); } }); // Copy the GDJS runtime and extension sources (used for autocompletions // in the IDE). This is optional as this takes a lot of time that would add // up whenever any change is made. if (!args['skip-sources']) { ...
@@ -53,6 +53,7 @@ if (!args['skip-sources']) { const startTime = Date.now(); + const pixiDestinationPath = path.join(destinationPath, 'Runtime-sources', 'pixi');
newIDE/app/scripts/import-GDJS-Runtime.js
26
JavaScript
0.429
question
53
51
51
false
Add Pixi and Three type definitions for JS events
7,266
4ian/GDevelop
10,154
JavaScript
D8H
D8H
onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInnerAreaFollowingParentSize(checked); onChange(); ...
```suggestion label={<Trans>Private (can only be used inside the extension)</Trans>} ```
eventsBasedObject.markAsTextContainer(checked); onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInner...
@@ -141,6 +141,15 @@ export default function EventsBasedObjectEditor({ }} /> )} + <Checkbox + label={<Trans>Private</Trans>}
newIDE/app/src/EventsBasedObjectEditor/index.js
26
JavaScript
0.643
suggestion
98
49
51
false
Allow to make custom objects private to an extension
7,275
4ian/GDevelop
10,154
JavaScript
4ian
D8H
eventsBasedObject.markAsTextContainer(checked); onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInner...
Won't it be a bit heavy? Should it be a tool tip?
onCheck={(e, checked) => { eventsBasedObject.markAsTextContainer(checked); onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { ...
@@ -141,6 +141,15 @@ export default function EventsBasedObjectEditor({ }} /> )} + <Checkbox + label={<Trans>Private (can only be used inside the extension)</Trans>}
newIDE/app/src/EventsBasedObjectEditor/index.js
26
JavaScript
0.143
question
49
50
51
false
Allow to make custom objects private to an extension
7,275
4ian/GDevelop
10,154
JavaScript
D8H
D8H
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
```suggestion <Trans>This object won't be visible in the scene editor.</Trans> ```
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
@@ -193,7 +206,21 @@ export class EventsBasedObjectTreeViewItemContent } renderRightComponent(i18n: I18nType): ?React.Node { - return null; + return this.eventsBasedObject.isPrivate() ? ( + <Tooltip + title={ + <Trans>This object won't be visible in the events editor.</Trans>
newIDE/app/src/EventsFunctionsList/EventsBasedObjectTreeViewItemContent.js
26
JavaScript
0.571
suggestion
94
51
51
false
Allow to make custom objects private to an extension
7,275
4ian/GDevelop
10,154
JavaScript
4ian
D8H
const lastObject = objects[objects.length - 1]; let objectToScrollTo; if ( newObjectDialogOpen && newObjectDialogOpen.from && // If a scene objectFolderOrObject is selected, move added assets next to or inside it. !newObjectDialogOpen.from.global )...
instead of moving them after they're created, should we instead modify the `targetObjectsContainer` to be the selected folder in the `AssetPackInstallDialog` instead of the root of the scene?
// Here, the last object in the array might not be the last object // in the tree view, given the fact that assets are added in parallel // See (AssetPackInstallDialog.onInstallAssets). const lastObject = objects[objects.length - 1]; if (newObjectDialogOpen && newObjectDialogOpe...
@@ -638,27 +638,62 @@ const ObjectsList = React.forwardRef<Props, ObjectsListInterface>( const onObjectsAddedFromAssets = React.useCallback( (objects: Array<gdObject>) => { + if (objects.length === 0) return; + objects.forEach(object => { onObjectCreated(object); }); - ...
newIDE/app/src/ObjectsList/index.js
26
JavaScript
0.571
question
192
51
51
false
Add objects installed from the asset store in selected folder
7,287
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
/* * GDevelop Core * Copyright 2015-2016 Victor Levasseur (victorlevasseur52@gmail.com). * This project is released under the MIT License. */ // NOLINTBEGIN #include "GDCore/String.h" #include <algorithm> #include <string.h> #include <iostream> #include "GDCore/CommonTools.h" #include "GDCore/Utf8/utf8proc.h" n...
Was this needed to be able to compile?
/* * GDevelop Core * Copyright 2015-2016 Victor Levasseur (victorlevasseur52@gmail.com). * This project is released under the MIT License. */ // NOLINTBEGIN #include "GDCore/String.h" #include <algorithm> #include <string.h> #include "GDCore/CommonTools.h" #include "GDCore/Utf8/utf8proc.h" namespace gd { cons...
@@ -10,7 +10,7 @@ #include <algorithm> #include <string.h> - +#include <iostream>
Core/GDCore/String.cpp
13
C++
0.071
question
38
38
38
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
#include "ObjectJsImplementation.h" #include <GDCore/IDE/Project/ArbitraryResourceWorker.h> #include <GDCore/Project/Object.h> #include <GDCore/Project/Project.h> #include <GDCore/Project/PropertyDescriptor.h> #include <GDCore/Serialization/Serializer.h> #include <GDCore/Serialization/SerializerElement.h> #include <em...
It was probably comitted by mistake.
#include "ObjectJsImplementation.h" #include <GDCore/IDE/Project/ArbitraryResourceWorker.h> #include <GDCore/Project/Object.h> #include <GDCore/Project/Project.h> #include <GDCore/Project/PropertyDescriptor.h> #include <GDCore/Serialization/Serializer.h> #include <GDCore/Serialization/SerializerElement.h> #include <em...
@@ -10,7 +10,7 @@ #include <map> -using namespace gd; +//using namespace gd;
GDevelop.js/Bindings/ObjectJsImplementation.cpp
13
C++
0.071
suggestion
36
38
38
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
'Bindings/glue.js', buildOutputPath + 'libGD.js', buildOutputPath + 'libGD.wasm', ], }, }, }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-string-replace'); grunt.loadNpmTasks('grunt-shell'); ...
It was probably comitted by mistake too.
'Bindings/glue.js', buildOutputPath + 'libGD.js', buildOutputPath + 'libGD.wasm', ], }, }, }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-string-replace'); grunt.loadNpmTasks('grunt-shell'); ...
@@ -183,6 +183,6 @@ module.exports = function (grunt) { 'build:raw', 'shell:copyToNewIDE', 'shell:generateFlowTypes', - 'shell:generateTSTypes', + //'shell:generateTSTypes',
GDevelop.js/Gruntfile.js
26
JavaScript
0.071
suggestion
40
29
29
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
// @flow import { ProjectScopedContainersAccessor } from '../../InstructionOrExpression/EventsScope'; import { type ResourceManagementProps } from '../../ResourcesList/ResourceSource'; /** * The props given to any behavior editor */ export type BehaviorEditorProps = {| behavior: gdBehavior, project: gdProject, ...
Did you forget to revert this line?
// @flow import { type ResourceManagementProps } from '../../ResourcesList/ResourceSource'; /** * The props given to any behavior editor */ export type BehaviorEditorProps = {| behavior: gdBehavior, project: gdProject, object: gdObject, resourceManagementProps: ResourceManagementProps, onBehaviorUpdated: (...
@@ -1,4 +1,5 @@ // @flow +import { ProjectScopedContainersAccessor } from '../../InstructionOrExpression/EventsScope';
newIDE/app/src/BehaviorsEditor/Editors/BehaviorEditorProps.flow.js
2
JavaScript
0.071
question
35
15
14
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { na...
You can run `npm run format` in `newIDE/app/`.
return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { na...
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname')
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
26
JavaScript
0.214
suggestion
46
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
The editor should ensure it never happens. If we only allow to define "AnimationName" properties in the "Behavior properties" tab here (and not in "Scene properties"): ![image](https://github.com/user-attachments/assets/099c544f-9d8d-4b86-b78e-0494f1d43319) There should always be an object when a behavior propeti...
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] }
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
26
JavaScript
0.5
suggestion
389
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
You can use the `mapFor` fonction to shorten the code a bit. The empty string should be added to the list.
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] } + + let animationArray =...
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
26
JavaScript
0.571
suggestion
107
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
if(!object) { return [{value:"Object is not valid !", label:"Object is not valid !"}] } let animationArray = []; for(let i = 0; i < object.getConfiguration().getAnimationsCount(); i++ ) { animationArray.push(object.getConfiguration().getAnimationName(i)); } return ...
I guess a new attribute `isAllowingFreeText` could be added and `PropertiesEditor` will only allow the current property value until we make a new component that does autocompletion one day. A easier solution would be to add the default property value to the list but the extension creator may decide to change it and ...
return []; } const animationArray = mapFor( 0, object.getConfiguration().getAnimationsCount(), i => { const animationName = object.getConfiguration().getAnimationName(i); if (animationName === '') { return null; } ...
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] } + + let animationArray =...
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
26
JavaScript
0.643
question
562
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
/* * GDevelop Core * Copyright 2015-2016 Victor Levasseur (victorlevasseur52@gmail.com). * This project is released under the MIT License. */ // NOLINTBEGIN #include "GDCore/String.h" #include <algorithm> #include <string.h> #include "GDCore/CommonTools.h" #include "GDCore/Utf8/utf8proc.h" namespace gd { const...
This file only have empty line changes. It should be reverted to have a clearer history.
/* * GDevelop Core * Copyright 2015-2016 Victor Levasseur (victorlevasseur52@gmail.com). * This project is released under the MIT License. */ // NOLINTBEGIN #include "GDCore/String.h" #include <algorithm> #include <string.h> #include "GDCore/CommonTools.h" #include "GDCore/Utf8/utf8proc.h" namespace gd { cons...
@@ -10,7 +10,6 @@ #include <algorithm> #include <string.h> - #include "GDCore/CommonTools.h"
Core/GDCore/String.cpp
13
C++
0.286
suggestion
88
38
38
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
}, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, hasImpactOnAllOtherFields: property.hasImpactOnOtherProperties(), }; } else if (valueType === 'textarea') { return { name, v...
The rest of the code uses this notation: `getChoices: () => {` I think it's a bit easier to read.
}, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, hasImpactOnAllOtherFields: property.hasImpactOnOtherProperties(), }; } else if (valueType === 'textarea') { return { name, v...
@@ -234,6 +234,37 @@ const createField = ( getDescription, hasImpactOnAllOtherFields: property.hasImpactOnOtherProperties(), }; + } else if (valueType === 'animationname') { + function getChoices() {
newIDE/app/src/CompactPropertiesEditor/PropertiesMapToCompactSchema.js
26
JavaScript
0.429
suggestion
98
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth > {ge...
Nitpick: This empty line is alone.
onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth > {ge...
@@ -944,6 +951,7 @@ export default function EventsBasedBehaviorPropertiesEditor({ )} /> )} +
newIDE/app/src/EventsBasedBehaviorEditor/EventsBasedBehaviorPropertiesEditor.js
26
JavaScript
0.071
nitpick
34
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
I wonder if it should be below the "Choice" type as it's a bit more specific. ```suggestion <SelectOption key="property-type-animationname" value="AnimationName" ...
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
@@ -729,6 +729,11 @@ export default function EventsBasedBehaviorPropertiesEditor({ value="Boolean" label={t`Boolean (checkbox)`} /> + <SelectOption + ...
newIDE/app/src/EventsBasedBehaviorEditor/EventsBasedBehaviorPropertiesEditor.js
26
JavaScript
1
suggestion
414
51
51
false
AnimationName selector
7,288
4ian/GDevelop
10,154
JavaScript
D8H
NeylMahfouf2608
const refocusValueField = useRefocusField(topLevelVariableValueInputRefs); const gdevelopTheme = React.useContext(GDevelopThemeContext); const draggedNodeId = React.useRef<?string>(null); const forceUpdate = useForceUpdate(); const [searchText, setSearchText] = React.useState<string>(''); const...
Why wasn't it done before? Any technical limitation?
// in the case the user wants to modify the value at the instance level // of an object's variable: in that case, a new variable is created and // the new variable value field needs to be focused. [number]: SimpleTextFieldInterface, |}>({}); // $FlowFixMe - Hard to fix issue regarding st...
@@ -636,7 +636,6 @@ const VariablesList = React.forwardRef<Props, VariablesListInterface>( variableContext = getParentVariableContext(variableContext); } if (variableContext.variable) { - // TODO Add ref to child-variables to allow to focus them.
newIDE/app/src/VariablesList/VariablesList.js
26
JavaScript
0.214
question
52
51
51
false
Fix variable list usability
7,290
4ian/GDevelop
10,154
JavaScript
ClementPasteau
AlexandreSi
} } } } else if (requestedTab === 'learn') { const courseId = routeArguments['course-id']; if (courseId && selectedCourse && selectedCourse.id === courseId) { setLearnCategory('course'); removeRouteArguments(['cours...
Can you check there is no side effects on other things like game dashboard? (small risk that the chapters are loaded and so ready, and the effect runs again even if the URL you're loading is totally not chapters related). If it's a problem, a potential solution is to divide the effects into multiple effects with ju...
} } } } else if (requestedTab === 'learn') { const courseId = routeArguments['course-id']; if (!areChaptersReady) { // Do not process requested tab before courses are ready. return; } if (cou...
@@ -332,6 +336,7 @@ export const HomePage = React.memo<Props>( setInitialPackUserFriendlySlug, setInitialGameTemplateUserFriendlySlug, games, + areChaptersReady,
newIDE/app/src/MainFrame/EditorContainers/HomePage/index.js
26
JavaScript
0.429
suggestion
356
51
51
false
Wait for courses to load before opening them
7,304
4ian/GDevelop
10,154
JavaScript
4ian
AlexandreSi
0, Math.min(255, parseFloat(newValue)) ); return true; } else if (propertyName === 'borderWidth') { objectContent.borderWidth = Math.max(0, parseFloat(newValue)); return true; } else if (propertyName === 'readOnly') { objectContent.readOnly = newVa...
Don't miss the return true to end the condition check and the function.
0, Math.min(255, parseFloat(newValue)) ); return true; } else if (propertyName === 'borderWidth') { objectContent.borderWidth = Math.max(0, parseFloat(newValue)); return true; } else if (propertyName === 'readOnly') { objectContent.readOnly = newVa...
@@ -79,6 +79,18 @@ module.exports = { objectContent.disabled = newValue === '1'; return true; } + else if(propertyName === 'maxLength') + { + objectContent.maxLength = newValue; + } + else if (propertyName === 'padding') + { + objectContent.padding = newVa...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.214
suggestion
71
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
Bouh
NeylMahfouf2608
.addExtraInfo('number') .addExtraInfo('telephone number') .addExtraInfo('url') .addExtraInfo('search') .setLabel(_('Input type')) .setDescription( _( 'By default, a "text" is single line. Choose "text area" to allow multiple lines to be entered.' ...
It's a good idea not to change those default values unless it's actually useful to your feature. I'm not sure that's the case, or is it?
.addExtraInfo('number') .addExtraInfo('telephone number') .addExtraInfo('url') .addExtraInfo('search') .setLabel(_('Input type')) .setDescription( _( 'By default, a "text" is single line. Choose "text area" to allow multiple lines to be entered.' ...
@@ -157,7 +166,7 @@ module.exports = { objectProperties .getOrCreate('fillColor') - .setValue(objectContent.fillColor || '255;255;255')
Extensions/TextInput/JsExtension.js
26
JavaScript
0.429
question
136
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setType('color') .setLabel(_('Color')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderOpacity') .setValue( (objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ...
Why do you convert the number to a string?
.setType('color') .setLabel(_('Color')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderOpacity') .setValue( (objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString())
Extensions/TextInput/JsExtension.js
26
JavaScript
0.071
question
42
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) ...
Definitely not the right group
).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) ...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.071
suggestion
30
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
(objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setV...
20 seems a bit low, you can use 40 instead I think.
(objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setV...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.286
suggestion
51
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
? objectContent.borderOpacity : 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) ...
You can precise that's the Input value max length (and not the size of the input rectangle for instance)
? objectContent.borderOpacity : 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) ...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.357
suggestion
104
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setType('number') .setLabel(_('Width')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Border appearance')); ...
This is not correctly formatted
.setType('number') .setLabel(_('Width')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Font')); objectProp...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.071
style
31
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('maxLength') ...
I think that the order is important here. I see that the text uses the order `left, center right`, so we might as well use the same here
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Font')); objectProperties .getOrCreate('maxLength') .setValu...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.571
suggestion
136
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), ...
```suggestion _('Input is submitted'), ``` I think it's better not mentioning any platform specific detail in the name
'number', gd.ParameterOptions.makeNewOptions().setDescription( _('Opacity (0-255)') ) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Ch...
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'),
Extensions/TextInput/JsExtension.js
26
JavaScript
0.786
suggestion
129
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM0_ is focused'), '', 'res/conditions/surObjet24.png', ...
```suggestion _('_PARAM0_ value was submitted'), ```
) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM...
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'), + _( + 'Check if the input is submitted, which usually happens when the ...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.571
suggestion
62
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
this._pixiObject.pivot.x = width / 2; this._pixiObject.pivot.y = height / 2; this._pixiObject.position.x = instance.getX() + width / 2; this._pixiObject.position.y = instance.getY() + height / 2; this._pixiObject.rotation = RenderedInstance.toRad( this._instance.getAng...
textOffset is not used anymore?
width = this.getCustomWidth(); height = this.getCustomHeight(); } this._pixiObject.pivot.x = width / 2; this._pixiObject.pivot.y = height / 2; this._pixiObject.position.x = instance.getX() + width / 2; this._pixiObject.position.y = instance.getY() + height / ...
@@ -755,8 +808,16 @@ module.exports = { this._pixiTextMask.endFill(); const isTextArea = object.content.inputType === 'text area'; + const textAlign = object.content.textAlign; + if (textAlign === 'left') this._pixiText.position.x = 0;
Extensions/TextInput/JsExtension.js
26
JavaScript
0.143
question
31
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
namespace gdjs { const userFriendlyToHtmlInputTypes = { text: 'text', email: 'email', password: 'password', number: 'number', 'telephone number': 'tel', url: 'url', search: 'search', }; const userFriendlyToHtmlAlignement = { left: 'left', center: 'center', right: 'right', ...
Does not seem useful in that case 😅
namespace gdjs { const userFriendlyToHtmlInputTypes = { text: 'text', email: 'email', password: 'password', number: 'number', 'telephone number': 'tel', url: 'url', search: 'search', }; const formatRgbAndOpacityToCssRgba = ( rgbColor: [float, float, float], opacity: float ) ...
@@ -9,6 +9,12 @@ namespace gdjs { search: 'search', }; + const userFriendlyToHtmlAlignement = {
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
12
TypeScript
0.143
suggestion
36
37
37
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
}; const formatRgbAndOpacityToCssRgba = ( rgbColor: [float, float, float], opacity: float ) => { return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRend...
```suggestion private _isSubmitted: boolean; ```
return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRenderer { private _object: gdjs.TextInputRuntimeObject; private _input: HTMLInputElement | HTMLTextAreaElem...
@@ -31,6 +37,8 @@ namespace gdjs { private _input: HTMLInputElement | HTMLTextAreaElement | null = null; private _instanceContainer: gdjs.RuntimeInstanceContainer; private _runtimeGame: gdjs.RuntimeGame; + private _form: HTMLFormElement | null = null; + private _isSubmited: boolean;
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.571
suggestion
54
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
this._isSubmited = false; } _createElement() { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); this._form = document.createElement('form'); this._form.setAttribute('id', 'dynamicForm'); const isTextArea = this._object.getInputTyp...
If you decide to keep `userFriendlyToHtmlAlignement`, it should be used here
const isTextArea = this._object.getInputType() === 'text area'; this._input = document.createElement(isTextArea ? 'textarea' : 'input'); this._form.style.border = '0px'; this._form.style.borderRadius = '0px'; this._form.style.backgroundColor = 'transparent'; this._form.style.positi...
@@ -41,24 +49,34 @@ namespace gdjs { this._runtimeGame = this._instanceContainer.getGame(); this._createElement(); + this._isSubmited = false; } _createElement() { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); + this._f...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.429
suggestion
76
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
isDisabled(): boolean { return this._disabled; } setReadOnly(value: boolean) { this._readOnly = value; this._renderer.updateReadOnly(); } isReadOnly(): boolean { return this._readOnly; } isFocused(): boolean { return this._renderer.isFocused(); } isSu...
In JS/TS, methods are usually written using camelCase
} setBorderWidth(width: float) { this._borderWidth = Math.max(0, width); this._renderer.updateBorderWidth(); } getBorderWidth(): float { return this._borderWidth; } setDisabled(value: boolean) { this._disabled = value; this._renderer.updateDisabled(); } ...
@@ -500,6 +531,37 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + console.log(this._renderer.getSubmitted()); + + return this._renderer.getSubmitted(); + } + + getMaxLength(): integer { + return this._maxLength; + }...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.214
style
54
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
setDisabled(value: boolean) { this._disabled = value; this._renderer.updateDisabled(); } isDisabled(): boolean { return this._disabled; } setReadOnly(value: boolean) { this._readOnly = value; this._renderer.updateReadOnly(); } isReadOnly(): boolean { r...
See other comment: I think this `isSubmitted` state should be stored at the object level.
this._borderOpacity = Math.max(0, Math.min(255, newOpacity)); this._renderer.updateBorderColorAndOpacity(); } getBorderOpacity(): float { return this._borderOpacity; } setBorderWidth(width: float) { this._borderWidth = Math.max(0, width); this._renderer.updateBorderWidth(...
@@ -500,6 +531,37 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + console.log(this._renderer.getSubmitted()); + + return this._renderer.getSubmitted();
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.429
suggestion
89
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setType('color') .setLabel(_('Color')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderOpacity') .setValue( (objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ...
Here and below: add .toString()
.setType('color') .setLabel(_('Color')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderOpacity') .setValue( (objectContent.borderOpacity != undefined ? objectContent.borderOpacity : 255 ).toString() ...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0))
Extensions/TextInput/JsExtension.js
26
JavaScript
0.071
suggestion
31
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
4ian
NeylMahfouf2608
namespace gdjs { const supportedInputTypes = [ 'text', 'email', 'password', 'number', 'telephone number', 'url', 'search', 'text area', ] as const; const supportedtextAlign = ['left', 'center', 'right'] as const; type SupportedInputType = typeof supportedInputTypes[number]; ty...
Capital T and below for the type too.
namespace gdjs { const supportedInputTypes = [ 'text', 'email', 'password', 'number', 'telephone number', 'url', 'search', 'text area', ] as const; const supportedTextAlign = ['left', 'center', 'right'] as const; type SupportedInputType = typeof supportedInputTypes[number]; ty...
@@ -9,9 +9,10 @@ namespace gdjs { 'search', 'text area', ] as const; + const supportedtextAlign = ['left', 'center', 'right'] as const;
Extensions/TextInput/textinputruntimeobject.ts
12
TypeScript
0.214
suggestion
37
37
37
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
4ian
NeylMahfouf2608
private _readOnly: boolean; private _isSubmitted: boolean; _renderer: TextInputRuntimeObjectRenderer; constructor( instanceContainer: gdjs.RuntimeInstanceContainer, objectData: TextInputObjectData ) { super(instanceContainer, objectData); this._string = objectData.content.i...
These can, sadly, be undefined. Add a default value in this case.
private _borderOpacity: float; private _borderWidth: float; private _disabled: boolean; private _readOnly: boolean; private _isSubmitted: boolean; _renderer: TextInputRuntimeObjectRenderer; constructor( instanceContainer: gdjs.RuntimeInstanceContainer, objectData: TextInputObjec...
@@ -113,7 +130,10 @@ namespace gdjs { this._borderWidth = objectData.content.borderWidth; this._disabled = objectData.content.disabled; this._readOnly = objectData.content.readOnly; - + this._padding = objectData.content.padding;
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.357
suggestion
65
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
4ian
NeylMahfouf2608
} getText() { return this._string; } setText(newString: string) { if (newString === this._string) return; this._string = newString; this._renderer.updateString(); } /** * Called by the renderer when the value of the input shown on the screen * was changed (b...
```suggestion onRendererFormSubmitted() { ```
* @deprecated use `getText` instead */ getString() { return this.getText(); } /** * Replace the text inside the text input. * @deprecated use `setText` instead */ setString(text: string) { this.setText(text); } getText() { return this._string; } ...
@@ -348,6 +379,10 @@ namespace gdjs { onRendererInputValueChanged(inputValue: string) { this._string = inputValue; } + + onRendererFormSubmitted(inputValue: boolean) {
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.571
suggestion
51
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
4ian
NeylMahfouf2608
return this._padding; } SetPadding(value: integer) { this._padding = value; } getTextAlign(): SupportedtextAlign { return this._textAlign; } setTextAlign(newTextAlign: string) { const lowercasedNewTextAlign = newTextAlign.toLowerCase(); if (lowercasedNewTextAlign ...
this._renderer.updatePadding();
isSubmitted(): boolean { return this._isSubmitted; } getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { if (this._maxLength === value) return; this._maxLength = value; this._renderer.updateMaxLength(); } getPadding(): integer { ...
@@ -500,6 +535,35 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + return this._isSubmitted; + } + + getMaxLength(): integer { + return this._maxLength; + } + setMaxLength(value: integer) { + this._maxLength = val...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.071
suggestion
31
38
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
4ian
NeylMahfouf2608
constructor( runtimeObject: gdjs.TextInputRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { this._object = runtimeObject; this._instanceContainer = instanceContainer; this._runtimeGame = this._instanceContainer.getGame(); this._createElement(); } ...
Could you split the lines where you change `this._form` and those where you change `this._input` ? it's a bit hard to read at the moment
constructor( runtimeObject: gdjs.TextInputRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { this._object = runtimeObject; this._instanceContainer = instanceContainer; this._runtimeGame = this._instanceContainer.getGame(); this._createElement(); } ...
@@ -47,18 +48,28 @@ namespace gdjs { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); + this._form = document.createElement('form'); const isTextArea = this._object.getInputType() === 'text area'; this._input = document.createElement(isTextA...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.571
question
136
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
this._object = runtimeObject; this._instanceContainer = instanceContainer; this._runtimeGame = this._instanceContainer.getGame(); this._createElement(); } _createElement() { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); ...
I'm not sure you mean `iOS` here. Did you mean a specific browser?
this._object = runtimeObject; this._instanceContainer = instanceContainer; this._runtimeGame = this._instanceContainer.getGame(); this._createElement(); } _createElement() { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); ...
@@ -47,18 +48,28 @@ namespace gdjs { if (!!this._input) throw new Error('Tried to recreate an input while it already exists.'); + this._form = document.createElement('form'); const isTextArea = this._object.getInputType() === 'text area'; this._input = document.createElement(isTextA...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.357
question
66
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
runtimeGameRenderer.convertCanvasToDomElementContainerCoords( workingPoint, workingPoint ); const pageLeft = workingPoint[0]; const pageTop = workingPoint[1]; workingPoint[0] = canvasRight; workingPoint[1] = canvasBottom; runtimeGameRenderer.convertCanvasToDomE...
I think the padding should have a minimum of 0, otherwise you might have some weird results
// Position the input on the container on top of the canvas. workingPoint[0] = canvasLeft; workingPoint[1] = canvasTop; runtimeGameRenderer.convertCanvasToDomElementContainerCoords( workingPoint, workingPoint ); const pageLeft = workingPoint[0]; const pageTop =...
@@ -210,12 +228,14 @@ namespace gdjs { const widthInContainer = pageRight - pageLeft; const heightInContainer = pageBottom - pageTop; - this._input.style.left = pageLeft + 'px'; - this._input.style.top = pageTop + 'px'; - this._input.style.width = widthInContainer + 'px'; - this._inp...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.286
suggestion
91
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDi...
to avoid having the `?`, you could do this: ```js const input = this._input; if (!input) return; // From then on, you can use `input` without TS complaining ```
); } updateBorderColorAndOpacity() { if (!this._input) return; this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this...
@@ -297,14 +317,36 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.786
suggestion
165
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
this._renderer.updateMaxLength(); } getPadding(): integer { return this._padding; } setPadding(value: integer) { this._padding = value; this._renderer.updatePadding(); } getTextAlign(): SupportedTextAlign { return this._textAlign; } setTextAlign(newTextAli...
Early return if values are equal?
return this._renderer.isFocused(); } isSubmitted(): boolean { return this._isSubmitted; } getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { if (this._maxLength === value) return; this._maxLength = value; this._renderer.update...
@@ -500,6 +536,36 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + return this._isSubmitted; + } + + getMaxLength(): integer { + return this._maxLength; + } + setMaxLength(value: integer) { + this._maxLength = val...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.071
question
33
42
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
isFocused(): boolean { return this._renderer.isFocused(); } isSubmitted(): boolean { return this._isSubmitted; } getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { this._maxLength = value; this._renderer.updateMaxLength(); }...
Early return if values are equal?
return this._disabled; } setReadOnly(value: boolean) { this._readOnly = value; this._renderer.updateReadOnly(); } isReadOnly(): boolean { return this._readOnly; } isFocused(): boolean { return this._renderer.isFocused(); } isSubmitted(): boolean { r...
@@ -500,6 +536,36 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + return this._isSubmitted; + } + + getMaxLength(): integer { + return this._maxLength; + } + setMaxLength(value: integer) { + this._maxLength = val...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.071
question
33
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
} getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { this._maxLength = value; this._renderer.updateMaxLength(); } getPadding(): integer { return this._padding; } setPadding(value: integer) { this._padding = value; this....
You can do the parsing as the first step and then you the returned value for the early return. Otherwise, you equality check above is wrong
} isReadOnly(): boolean { return this._readOnly; } isFocused(): boolean { return this._renderer.isFocused(); } isSubmitted(): boolean { return this._isSubmitted; } getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { ...
@@ -500,6 +536,36 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + return this._isSubmitted; + } + + getMaxLength(): integer { + return this._maxLength; + } + setMaxLength(value: integer) { + this._maxLength = val...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.357
bug
139
49
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
I added a comment on the PR, I think you should add in the description that this property will not be used if the input type is a number.
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.571
suggestion
137
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
.setType('choice') .addExtraInfo('left') .addExtraInfo('center') .addExtraInfo('right') .setLabel(_('Text alignment')) .setGroup(_('Font')); return objectProperties; }; textInputObject.content = { initialValue: '', placeholder: 'Touch to start t...
Should it be a string here? Also, should you use -1/0 instead as an initial value?
objectProperties .getOrCreate('textAlign') .setValue(objectContent.textAlign || 'left') .setType('choice') .addExtraInfo('left') .addExtraInfo('center') .addExtraInfo('right') .setLabel(_('Text alignment')) .setGroup(_('Font')); return object...
@@ -216,6 +249,9 @@ module.exports = { borderWidth: 1, readOnly: false, disabled: false, + padding: 0, + textAlign: 'left', + maxLength: '20',
Extensions/TextInput/JsExtension.js
26
JavaScript
0.286
question
82
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
I think you could use `(this._object.getOpacity() / 255).toFixed(3)` instead. The result of the division could be `0.59200000000005`, and I'm not sure if CSS has some limitations about that.
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
@@ -246,8 +271,8 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = '' + this._object.getOpacity() / 255;
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.571
suggestion
190
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
Is the `|| 'left'` necessary? I think we can be confident that the object only stores correct values
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
@@ -297,14 +322,37 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.5
suggestion
100
43
43
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
private _isSubmitted: boolean; _renderer: TextInputRuntimeObjectRenderer; constructor( instanceContainer: gdjs.RuntimeInstanceContainer, objectData: TextInputObjectData ) { super(instanceContainer, objectData); this._string = objectData.content.initialValue; this._placeho...
You could use `parseTextAlign` here.
private _borderWidth: float; private _disabled: boolean; private _readOnly: boolean; private _isSubmitted: boolean; _renderer: TextInputRuntimeObjectRenderer; constructor( instanceContainer: gdjs.RuntimeInstanceContainer, objectData: TextInputObjectData ) { super(instanceC...
@@ -113,7 +130,10 @@ namespace gdjs { this._borderWidth = objectData.content.borderWidth; this._disabled = objectData.content.disabled; this._readOnly = objectData.content.readOnly; - + this._padding = objectData.content.padding || 0; + this._textAlign = objectData.content.textAlign || 'l...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.286
suggestion
36
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { if (this._maxLength === value) return; this._maxLength = value; this._renderer.updateMaxLength(); } getPadding(): integer { return this._padding; } setPadding(value: integer) { ...
I think you should also prevent the function from setting negative values for the padding, there should be a minimum of 0
isReadOnly(): boolean { return this._readOnly; } isFocused(): boolean { return this._renderer.isFocused(); } isSubmitted(): boolean { return this._isSubmitted; } getMaxLength(): integer { return this._maxLength; } setMaxLength(value: integer) { if (th...
@@ -500,6 +535,40 @@ namespace gdjs { isFocused(): boolean { return this._renderer.isFocused(); } + isSubmitted(): boolean { + return this._isSubmitted; + } + + getMaxLength(): integer { + return this._maxLength; + } + setMaxLength(value: integer) { + if (this._maxLength =...
Extensions/TextInput/textinputruntimeobject.ts
26
TypeScript
0.429
suggestion
121
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
```suggestion 'The maximum length of the input value (this property will be ignored if the input type is a number).' ```
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
@@ -200,6 +209,34 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
Extensions/TextInput/JsExtension.js
26
JavaScript
0.857
suggestion
134
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
```suggestion (this._object.getOpacity() / 255).toFixed(3); ``` toFixed returns as string already
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
@@ -246,8 +271,9 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = + '' + (this._object.getOpacity() / 255).toFixed(3);
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
26
TypeScript
0.714
suggestion
108
51
51
false
Improvement features for Input text box
7,308
4ian/GDevelop
10,154
JavaScript
AlexandreSi
NeylMahfouf2608
isOver, canDrop, }) => { setIsStayingOver(isOver, canDrop); let itemRow = ( <div className={classNames(classes.rowContentSide, { [classes.rowContentSideLeft]: !node.item.isRoot, [classes.rowContentExtraPadding]: !...
Use SVG directly and remove use of Material UI (See comment at PR level)
isOver, canDrop, }) => { setIsStayingOver(isOver, canDrop); let itemRow = ( <div className={classNames(classes.rowContentSide, { [classes.rowContentSideLeft]: !node.item.isRoot, [classes.rowContentExtraPadding]: !...
@@ -358,9 +358,9 @@ const TreeViewRow = <Item: ItemBaseAttributes>(props: Props<Item>) => { disabled={node.disableCollapse} > {node.collapsed ? ( - <ArrowHeadRight fontSize="small" /> + <ChevronArrowRight/> ...
newIDE/app/src/UI/TreeView/TreeViewRow.js
26
JavaScript
0.286
suggestion
72
51
51
false
Consistency on arrows
7,322
4ian/GDevelop
10,154
JavaScript
AlexandreSi
Bouh
title, isFolded, toggleFolded, renderContent, renderContentAsHiddenWhenFolded, noContentMargin, onOpenFullEditor, onAdd, }: {| title: React.Node, isFolded: boolean, toggleFolded: () => void, renderContent: () => React.Node, renderContentAsHiddenWhenFolded?: boolean, noContentMargin?: boolean...
Asked on the mock up on Figma: why is it not ...ArrowRight here?
title, isFolded, toggleFolded, renderContent, renderContentAsHiddenWhenFolded, noContentMargin, onOpenFullEditor, onAdd, }: {| title: React.Node, isFolded: boolean, toggleFolded: () => void, renderContent: () => React.Node, renderContentAsHiddenWhenFolded?: boolean, noContentMargin?: boolean...
@@ -166,9 +166,9 @@ const TopLevelCollapsibleSection = ({ <LineStackLayout noMargin alignItems="center"> <IconButton size="small" onClick={toggleFolded}> {isFolded ? ( - <SquaredDoubleChevronArrowUp style={styles.icon} /> + <SquaredChevronArrowUp style={styles....
newIDE/app/src/ObjectEditor/CompactObjectPropertiesEditor/index.js
26
JavaScript
0.214
question
64
51
51
false
Consistency on arrows
7,322
4ian/GDevelop
10,154
JavaScript
AlexandreSi
Bouh