Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Tool.updateEnabledState behavior and related changes #3800

Merged
merged 4 commits into from
Aug 3, 2023

Commits on Aug 2, 2023

  1. Scripting: Fixed Tool.updateEnabledState behavior

    The setTargetLayerType(0) call in the ScriptedTool constructor happened
    before the ScriptedTool instance was set as the prototype of the
    provided script object. If the provided updateEnabledState would then
    set the "this.enabled" property, it would override the Tool.enabled
    property instead of changing it and cause all further attempts to change
    the "this.enabled" property to not affect the Tool.enabled property.
    
    Fixed by making sure the prototype is set before a possible call to
    updateEnabledState happens.
    
    Closes mapeditor#3756
    bjorn committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    ab61faa View commit details
    Browse the repository at this point in the history
  2. Fixed crash when a tool deactivates itself during activation

    The only known way to trigger this would be to implement a scripted tool
    that sets "this.enabled" to false in the "activated" callback.
    bjorn committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    29d5634 View commit details
    Browse the repository at this point in the history
  3. docs: Split ToolDefinition from Tool for registerTool function

    The argument passed to registerTool is not entirely the same as the Tool
    instance it returns. Most of its properties are optional and some
    properties are only available on the Tool instance.
    
    The functions in ToolDefinition now define the type of 'this' as Tool.
    
    See mapeditor#3756
    bjorn committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    b918fc1 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2023

  1. docs: Added "| null" in a few more places

    Needed because otherwise TS assumes the references will never be null.
    bjorn committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    a0339fa View commit details
    Browse the repository at this point in the history