Skip to content

Support editing arbitrary precisions for GlobeCoordinates #58

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

Merged
merged 2 commits into from
Jun 11, 2014

Conversation

adrianheine
Copy link
Contributor

Bug 65535.

@@ -11,6 +11,7 @@
"valueview-expert-unsupportedvalue-unsupporteddatatype": "Handling of values for \"$1\" data type is not yet supported.",
"valueview-expert-emptyvalue-empty": "empty",
"valueview-expert-globecoordinateinput-precision": "Precision:",
"valueview-expert-globecoordinateinput-customprecision": "custom value ($1)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer something like "±$1° (custom)".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is already formatted correctly. I don't care about the position of the value and »custom«, might just switch that. @lydiapintscher?

@@ -11,6 +11,7 @@
"valueview-expert-unsupportedvalue-unsupporteddatatype": "Handling of values for \"$1\" data type is not yet supported.",
"valueview-expert-emptyvalue-empty": "empty",
"valueview-expert-globecoordinateinput-precision": "Precision:",
"valueview-expert-globecoordinateinput-customprecision": "custom ($1)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After showing and chatting with @lydiapintscher we decided to use "special ($1)" (without any rounding) to not make users think this can be "customized" via the UI.

if( value.custom ) {
this._customValue = this.rotator.options.values.push( value ) - 1;
this._$customItem = this.rotator._addMenuItem( value );
value = value.value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, this is odd. What happens to the other values that are not custom? Are they supposed to be numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numbers or strings, yes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "number or object"? I may be wrong but it looks like you are introducing this. Why not always make it an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-custom values are numbers or strings. It's like this:

Listrotators are initialized with an array of name/value pairs. These are the non-custom values which are always shown. Setting the rotator to one of these values is trivial using .value and ._setValue. On the other hand, our experts need to be able to set the Listrotator to a value which is not in this initial list (a ›custom‹ value). This is done by injecting a name/value pair into the Listrotator and then calling .value and ._setValue.

This module here (the ExpertExtender's Listrotator extension) wraps the ugly injection and handles cleaning up. In order to do that, it has to recognize a given value as either custom or not. It could also just try to find it in the Listrotator's value array, but that would be uglier, slower and more error-prone. So the expert has to explicitly say that a value it passes is not just a pre-configured value from the Listrotator's config, but indeed something new and custom. That's done via the custom property, and it also needs to pass a name and a value, because the Listrotator obviously needs a name and a value.

The only thing I can imagine we could change without rewriting a lot of Listrotator (which I tried to avoid with this patch) is changing the signature of the getUpstreamValue argument of ExpertExtender.Listrotator to always return an object, either { value: 'normal value' } or { value: 'custom value', label: 'label for custom value', custom: true }. I don't see much of an advantage doing that, though.

this._customValue = null;
}
if( value.custom ) {
this._customValue = this.rotator.options.values.push( value ) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable name is misleading. Should be _customValueIndex or something like that.

It's also missing a declaration.

thiemowmde added a commit that referenced this pull request Jun 11, 2014
Support editing arbitrary precisions for GlobeCoordinates
@thiemowmde thiemowmde merged commit ca74115 into master Jun 11, 2014
@thiemowmde thiemowmde deleted the editCoordPrecision branch June 11, 2014 13:02
@thiemowmde thiemowmde added this to the 0.6.2 milestone Jun 11, 2014
adrianheine added a commit that referenced this pull request Jun 13, 2014
thiemowmde added a commit that referenced this pull request Jun 15, 2014
@thiemowmde thiemowmde modified the milestones: 0.6.2, 0.6.3 Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants