Skip to content

setText(null) does not work in this case #101

@fabs07

Description

@fabs07

When using code from sample

    polylineLayer.on('mouseover', function () {
        this.setText('            \u25BA    ', {repeat: true, offset: 0, attributes: {'fill': 'lightblue'}});
    });

    polylineLayer.on('mouseout', function () {
        this.setText(null);
    });

setText(null) works as expected

I tried to replace this by a zoom controled version

	map.on("zoomend", function() {
		var zoom = this.getZoom();
		console.log(zoom);
		if (zoom > 10) {
			console.log("show");
			polylineLayer.setText('            \u25BA    ', {repeat: true, offset: 0, attributes: {'fill': 'lightblue'}});
		} else {
			console.log("hide");
			polylineLayer.setText(null);
		}
	})

In this case, setText shows Text after zoom level 11 is reached, but it does not remove text after zoom level decreases to 10 or lower. Anyway console.log('hide') is called

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