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

Cannot define blocks with group in existing category, say 'Math', and specify group order? #4003

Open
matthewtebbs opened this issue Mar 23, 2018 · 0 comments

Comments

@matthewtebbs
Copy link
Contributor

The groups attribute on an already existing namespace block category does not get applied to the existing category definition.

For example, if a target defines additional blocks in category Math using the usual namespace declaration, the attribute 'groups' does not seem to be applied to the existing category definition.

For example in the marked up declarations below the intent is to have the Vector group be below the built-in blocks that already exist in category Math.

Is there another way to do this?

//% groups='["other", "Vector"]'
declare namespace math {
    /**
     * Create vector.
     * @param x number, eg: 0
     * @param y number, eg: 0
     * @param z number, eg: 0
     */
    //% blockId="vector"
    //% block="X %x|Y %y|Z %z"
    //% group="Vector"
    //% shim=math3d::vector
    function vector(x?: number, y?: number, z?: number): Vector;

    /**
     * Unit vector.
     */
    //% blockId="vector_unit"
    //% block="unit vector"
    //% group="Vector"
    //% shim=math3d::unitVector
    function unitVector(): Vector;

    /**
     * Convert degress to radians.
     * @param degrees number, e.g. 0
     */
    //% blockId=convert_deg_to_rad
    //% block="%degrees degrees in radians"
    //% shim=math::degreesInRadians
    //% advanced=true
    function degreesInRadians(degrees: number): number;

    /**
     * Convert radians to degrees.
     * @param radians number, e.g. 0
     */
    //% blockId=convert_rad_to_deg
    //% block="%radians radians in degrees"
    //% shim=math::radiansInDegrees
    //% advanced=true
    function radiansInDegrees(radians: number): number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants