Skip to content

The "cursorHeading" variable and methods for the Field plugin are not implemented, but are exposed to users #17

@etluconk

Description

@etluconk

When trying to draw a shape onto the Field plugin's canvas from an opmode, the cursorHeading variable has no effect on the rotation of future drawings on the canvas.

In FieldManager.kt, you can find a variable cursorHeading defined along with cursorX and cursorY:

var cursorX = 0.0
var cursorY = 0.0
var cursorHeading = 0.0

The version of panels we are using on our robot (our codebase uses java, but the idea still applies) even has a method calledsetCursorHeading():

panelsFieldManager.setCursorHeading(45.0); // This line seems to have no effect on drawing

Despite it seeming obvious that using these methods should allow future drawings to be rotated by whatever cursorHeading is, this doesn't seem to be implemented at all. In fact, cursorHeading is not mentioned in any of the drawing functions for FieldManager.kt:

fun circle(r: Double) {
    canvas.items.add(
        Circle(
            cursorX,
            cursorY,
            r,
            currentStyle
        )
    )
}

fun line(x2: Double, y2: Double) {
    canvas.items.add(
        Line(
            cursorX,
            cursorY,
            x2,
            y2,
            currentStyle
        )
    )
}

fun rect(w: Double, h: Double) {
    canvas.items.add(
        Rectangle(
            cursorX,
            cursorY,
            w, h,
            currentStyle
        )
    )
}

...and isn't present in the image drawing function either:

fun img(w: Double, h: Double, id: UUID) {
    canvas.items.add(
        Image(
            cursorX,
            cursorY,
            w, h,
            id
        )
    )
}

To a user, it seems like cursorHeading should rotate future drawn shapes, aligning with the behavior of cursorX and cursorY, but it's very confusing when using this variable has no effect on drawing rotations. Maybe this kind of behavior should be implemented, or at least the intended behavior should be better communicated to developers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions