amaccann / phaser3-drag-select

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phaser 3 Drag Select Plugin

Config settings

In your game config:

import DragSelectPlugin from 'path-to';

const config = {
    ...
    plugins: {
        global: [
            { key: 'DragSelectPlugin', plugin: DragSelectPlugin }
        ]
    },
    ...
this.dragSelect = this.plugins.start('DragSelectPlugin', 'dragSelect');
this.dragSelect.setup(this, {
    camera: <MainGameSceneCamera>,
    cameraEdgeAcceleration: 0.015,
    cameraEdgeBuffer: 50,
    childSelector: <Function>,
    dragCameraBy: 2,        // right-button
    mouseClickToTrack: 1,   // left-button
    mouseAmendSelectWith: 'shift',
    mouseToggleSelectWith: 'ctrl',
    outlineColor: 0x00ff00,
    outlineWidth: 2,
    onPreview: <Function>,
    onSelect: <Function>,
    rectBgColor: 0x33ff33,
    rectAlpha: 0.5,
});

Functions

setup(scene, config)

Kind: global function

Param Type Description
scene Phaser.Scene Target scene to attach the plugin's logic against
config Object Configuration object to pass to plugin

isEnabled() ⇒ Boolean

Returns the current "enabled" status of the Plugin's "interface" scene

Kind: global function

setConfig(config)

Updates the plugin's configuration with new values

Kind: global function

Param Type Description
config Object new configuration object

disable()

If enabled, disable the plugin

Kind: global function

enable()

If not already enabled, enable the plugin

Kind: global function

About


Languages

Language:JavaScript 99.7%Language:HTML 0.3%