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

Convert internal variables (selectedObject, draggedObject, ...) into instance variables #130

Closed
jscastro76 opened this issue Dec 5, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@jscastro76
Copy link
Owner

map declares several variables as internal. It would be very useful to have those variables as part of the map instance.

This is an example from how these variables could be used from a page, for instance, for a button to change the wireframe value of an object, checking first if there's an object selected in the map. Currently you have to keep these variables in the page script side capturing first them from the corresponding events

$('#wireButton').on('click', function () {
	if (map.selectedObject) { //if selectedObject is part of the instance we can do this
		if (map.selectedObject.wireframe) {
			map.selectedObject.wireframe = false;
		} else {
			map.selectedObject.wireframe = true;
		}
	}
	map.repaint = true;
});

The variables to be part of the instance should be:

let selectedObject; //selected object through click
let draggedObject; //dragged object through mousedown + mousemove
let draggedAction; //dragged action to notify frontend
let overedObject; //overed object through mouseover
let overedFeature;//overed state for extrusion layer features
let selectedFeature;//selected state id for extrusion layer features
@jscastro76 jscastro76 added this to the v.2.1.2. milestone Dec 5, 2020
@jscastro76 jscastro76 self-assigned this Dec 5, 2020
jscastro76 added a commit that referenced this issue Dec 6, 2020
- add options.rotate and options.scale for Objects3D #126
- Create a new example with Three.js extrusions based on standard geoJson #127 Added a new example [17-extrusions.html](https://github.com/jscastro76/threebox/blob/master/examples/17-extrusions.html)
- Convert internal variables (`selectedObject`, `draggedObject`, ...) into instance variables #130
- Deprecate `tb.setLayerZoomVisibility`, overlaps with `tb.toggleLayer` #134
- when an object is wireframed, all its clones are too #124
- Error when wireframing all the objects #131
- While dragging an object if mouse overs a label it stops dragging #132
- A layer shouldn't be shown explicitely if it's not in the right zoom range #133
jscastro76 added a commit that referenced this issue Dec 9, 2020
Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements and bugs.

#### ✨ Enhancements

- #125 three.js draw geojson.
- #126 add options.rotate and options.scale for Objects3D.
- #127 Create a new example with Three.js extrusions based on standard geoJson. Added a new example [17-extrusions.html](https://github.com/jscastro76/threebox/blob/master/examples/17-extrusions.html)
- #130 Convert internal variables (`selectedObject`, `draggedObject`, ...) into instance variables .
- #134 Deprecate `tb.setLayerZoomVisibility`, overlaps with `tb.toggleLayer`.
- #138 expose `SunCalc.toJulian`

#### 🪲 Bug fixes

- #124 when an object is wireframed, all its clones are too.
- #131 Error when wireframing all the objects.
- #132 While dragging an object if mouse overs a label it stops dragging.
- #133 A layer shouldn't be shown explicitely if it's not in the right zoom range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant