Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

update range int size#1479

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
chillenberger merged 1 commit intomasterfromdan-pricing-update-2
May 24, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletionspgml-dashboard/src/components/inputs/range/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,11 +32,11 @@ impl From<&str> for InterpolationType {
#[template(path = "inputs/range/template.html")]
pub struct Range {
color: String,
min:i32,
max:i32,
min:i64,
max:i64,
interpolation_type: InterpolationType,
target: Target,
initial_value:i32,
initial_value:i64,
}

impl Range {
Expand All@@ -56,12 +56,12 @@ impl Range {
self
}

pub fn min(mut self, min:i32) -> Self {
pub fn min(mut self, min:i64) -> Self {
self.min = min;
self
}

pub fn max(mut self, max:i32) -> Self {
pub fn max(mut self, max:i64) -> Self {
self.max = max;
self
}
Expand All@@ -76,7 +76,7 @@ impl Range {
self
}

pub fn initial_value(mut self, initial_value:i32) -> Self {
pub fn initial_value(mut self, initial_value:i64) -> Self {
self.initial_value = initial_value;
self
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,6 @@ export default class extends Controller {
initialize() {}

connect() {
// console.log("range connected", this.initialValue)
this.rangeTarget.value =
this.interpolationTypeValue === "exponential"
? this.exponentialInterpolationSolveX(this.initialValue)
Expand DownExpand Up@@ -52,7 +51,7 @@ export default class extends Controller {

exponentialInterpolation(value) {
if (value < 1) {
return0;
returnthis.minValue;
}

let minValue = this.minValue > 1 ? this.minValue : 1;
Expand All@@ -72,7 +71,6 @@ export default class extends Controller {
let numerator = Math.log(value / minValue);
let denominator = Math.log(this.maxValue / minValue);
let out = (numerator / denominator) * 100;
// console.log(numerator, denominator, out, Number(out.toPrecision(3)))
return parseInt(Number(out.toPrecision(3)));
}

Expand All@@ -82,7 +80,6 @@ export default class extends Controller {
}

linearInterpolationSolveX(value) {
// console.log("linear solve x ", value, this.minValue, this.maxValue)
let out = ((value - this.minValue) / (this.maxValue - this.minValue)) * 100;
return parseInt(Number(out.toPrecision(3)));
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,12 +8,12 @@ use sailfish::TemplateOnce;
pub struct RangeGroupPricingCalc {
interpolation_type: InterpolationType,
include_slider: bool,
min:i32,
max:i32,
min:i64,
max:i64,
target: StimulusTarget,
label: String,
name: String,
initial_value:i32,
initial_value:i64,
}

impl RangeGroupPricingCalc {
Expand All@@ -40,12 +40,12 @@ impl RangeGroupPricingCalc {
self
}

pub fn min(mut self, min:i32) -> Self {
pub fn min(mut self, min:i64) -> Self {
self.min = min;
self
}

pub fn max(mut self, max:i32) -> Self {
pub fn max(mut self, max:i64) -> Self {
self.max = max;
self
}
Expand All@@ -65,7 +65,7 @@ impl RangeGroupPricingCalc {
self
}

pub fn initial_value(mut self, initial_value:i32) -> Self {
pub fn initial_value(mut self, initial_value:i64) -> Self {
self.initial_value = initial_value;
self
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp