Compare commits
No commits in common. "2c8b5639eb8a03a8257baa0e3c06a83f70c840a1" and "e70ed9e885ef52671d4c8c0049d5e3f4d80ae427" have entirely different histories.
2c8b5639eb
...
e70ed9e885
15
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "cryptic-clock",
|
"name": "cryptic-clock",
|
||||||
"author": "jennyaa",
|
"author": "jennyaa",
|
||||||
"version": "1.3",
|
"version": "1.2",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"pebble-app"
|
"pebble-app"
|
||||||
@ -25,14 +25,11 @@
|
|||||||
"watchapp": {
|
"watchapp": {
|
||||||
"watchface": true
|
"watchface": true
|
||||||
},
|
},
|
||||||
"messageKeys": {
|
"messageKeys": [
|
||||||
"BACKGROUND_COLOR": 10000,
|
"BACKGROUND_COLOR",
|
||||||
"DIGIT_COLOR": 10001,
|
"DIGIT_COLOR",
|
||||||
"FRAME_COLOR": 10002,
|
"FRAME_COLOR"
|
||||||
"TIME_FORMAT_OVERRIDE": 10010,
|
],
|
||||||
"12H_START": 10011,
|
|
||||||
"24H_START": 10012
|
|
||||||
},
|
|
||||||
"capabilities": [ "configurable" ],
|
"capabilities": [ "configurable" ],
|
||||||
"resources": {
|
"resources": {
|
||||||
"media": [
|
"media": [
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@ -5,10 +5,6 @@
|
|||||||
using namespace Pebble;
|
using namespace Pebble;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static constexpr int16_t extraDigits = 6;
|
|
||||||
static constexpr int16_t digitHeight = 56;
|
|
||||||
static constexpr int16_t digitCount = 10;
|
|
||||||
|
|
||||||
void draw_digit(const Pebble::GContext& ctx, const Pebble::GRect& bounds, const uint16_t digit) {
|
void draw_digit(const Pebble::GContext& ctx, const Pebble::GRect& bounds, const uint16_t digit) {
|
||||||
Pebble::GBitmapBase& bitmap = bitmaps::GetDigitBitmap(digit);
|
Pebble::GBitmapBase& bitmap = bitmaps::GetDigitBitmap(digit);
|
||||||
auto rect = bitmap.GetBounds();
|
auto rect = bitmap.GetBounds();
|
||||||
@ -19,13 +15,13 @@ namespace {
|
|||||||
|
|
||||||
void DigitLayerInner::OnUpdate(const Pebble::GContext& ctx) {
|
void DigitLayerInner::OnUpdate(const Pebble::GContext& ctx) {
|
||||||
auto bounds = this->GetBounds();
|
auto bounds = this->GetBounds();
|
||||||
// LOG("Digit layer update. %d digits", digitCount);
|
// LOG("Digit layer update. %d digits", this->digitCount);
|
||||||
|
|
||||||
ctx.SetCompositingMode(GCompOpSet);
|
ctx.SetCompositingMode(GCompOpSet);
|
||||||
for (int i = 0; i <= digitCount + 2 * extraDigits; i++) {
|
for (int i = 0; i <= this->digitCount + 2 * this->extraDigits; i++) {
|
||||||
Pebble::GRect rect(0, i * digitHeight, bounds.size.w, digitHeight);
|
Pebble::GRect rect(0, i * this->digitHeight, bounds.size.w, this->digitHeight);
|
||||||
uint16_t digit = ((i - extraDigits) % digitCount + digitCount) % digitCount;
|
uint16_t digit = ((i - this->extraDigits) % this->digitCount + this->digitCount) % this->digitCount % 10;
|
||||||
// LOG("Digit %d -> %d", i - extraDigits, digit);
|
// LOG("Digit %d -> %d", i - this->extraDigits, digit);
|
||||||
draw_digit(ctx, rect, digit);
|
draw_digit(ctx, rect, digit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +35,7 @@ DigitLayer::DigitLayer() : Pebble::SimpleLayer(Pebble::GRect()) {
|
|||||||
void DigitLayer::UpdateLayout() {
|
void DigitLayer::UpdateLayout() {
|
||||||
auto bounds = this->GetBounds();
|
auto bounds = this->GetBounds();
|
||||||
this->scrollLayer.SetFrame(bounds);
|
this->scrollLayer.SetFrame(bounds);
|
||||||
bounds.size.h = (digitCount + 2 * extraDigits) * digitHeight;
|
bounds.size.h = (this->innerLayer.digitCount + 2 * this->innerLayer.extraDigits) * this->innerLayer.digitHeight;
|
||||||
this->innerLayer.SetFrame(bounds);
|
this->innerLayer.SetFrame(bounds);
|
||||||
this->scrollLayer.SetContentSize(bounds.size);
|
this->scrollLayer.SetContentSize(bounds.size);
|
||||||
}
|
}
|
||||||
@ -47,21 +43,18 @@ void DigitLayer::UpdateLayout() {
|
|||||||
|
|
||||||
int16_t DigitLayer::ComputeOffset(uint16_t digit) {
|
int16_t DigitLayer::ComputeOffset(uint16_t digit) {
|
||||||
auto bounds = this->GetBounds();
|
auto bounds = this->GetBounds();
|
||||||
return bounds.size.h / 2 - digitHeight / 2 - (digit + extraDigits) * digitHeight;
|
return bounds.size.h / 2 - this->innerLayer.digitHeight / 2
|
||||||
|
- (digit + this->innerLayer.extraDigits) * this->innerLayer.digitHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DigitLayer::RotateTo(uint16_t digit, bool animate) {
|
void DigitLayer::RotateTo(uint16_t digit, bool animate) {
|
||||||
// LOG("Digit %d, out of %d", digit, digitCount);
|
// LOG("Digit %d, out of %d", digit, innerLayer.digitCount);
|
||||||
digit %= digitCount;
|
digit %= innerLayer.digitCount;
|
||||||
auto currentOffset = this->scrollLayer.GetContentOffset();
|
auto currentOffset = this->scrollLayer.GetContentOffset();
|
||||||
if (digit > this->currentDigit + digitCount / 2) {
|
if (digit == 0 && currentOffset.y <= ComputeOffset(this->innerLayer.digitCount / 2)) {
|
||||||
currentOffset.y -= digitCount * digitHeight;
|
currentOffset.y += this->innerLayer.digitCount * this->innerLayer.digitHeight;
|
||||||
this->scrollLayer.SetContentOffset(currentOffset, false);
|
|
||||||
} else if (digit < this->currentDigit - digitCount / 2) {
|
|
||||||
currentOffset.y += digitCount * digitHeight;
|
|
||||||
this->scrollLayer.SetContentOffset(currentOffset, false);
|
this->scrollLayer.SetContentOffset(currentOffset, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->scrollLayer.SetContentOffset(this->ComputeOffset(digit), animate);
|
this->scrollLayer.SetContentOffset(this->ComputeOffset(digit), animate);
|
||||||
this->currentDigit = digit;
|
|
||||||
}
|
}
|
||||||
@ -3,6 +3,10 @@
|
|||||||
#include <pebble-cpp/pebble.hpp>
|
#include <pebble-cpp/pebble.hpp>
|
||||||
|
|
||||||
class DigitLayerInner : public Pebble::CustomLayer {
|
class DigitLayerInner : public Pebble::CustomLayer {
|
||||||
|
static constexpr int16_t extraDigits = 2;
|
||||||
|
static constexpr int16_t digitHeight = 56;
|
||||||
|
int16_t digitCount = 10;
|
||||||
|
|
||||||
DigitLayerInner() : Pebble::CustomLayer(Pebble::GRect()) {}
|
DigitLayerInner() : Pebble::CustomLayer(Pebble::GRect()) {}
|
||||||
|
|
||||||
static void DrawDigit(const Pebble::GContext& ctx, const Pebble::GRect& bounds, const uint16_t digit);
|
static void DrawDigit(const Pebble::GContext& ctx, const Pebble::GRect& bounds, const uint16_t digit);
|
||||||
@ -16,10 +20,15 @@ protected:
|
|||||||
class DigitLayer : public Pebble::SimpleLayer {
|
class DigitLayer : public Pebble::SimpleLayer {
|
||||||
DigitLayerInner innerLayer;
|
DigitLayerInner innerLayer;
|
||||||
Pebble::ScrollLayer scrollLayer;
|
Pebble::ScrollLayer scrollLayer;
|
||||||
int16_t currentDigit = 0;
|
|
||||||
public:
|
public:
|
||||||
DigitLayer();
|
DigitLayer();
|
||||||
|
|
||||||
|
void SetDigitCount(uint16_t cnt = 10) {
|
||||||
|
if (this->innerLayer.digitCount != cnt) {
|
||||||
|
this->innerLayer.digitCount = cnt;
|
||||||
|
this->UpdateLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
void UpdateLayout();
|
void UpdateLayout();
|
||||||
void RotateTo(uint16_t digit, bool animate=true);
|
void RotateTo(uint16_t digit, bool animate=true);
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
using namespace Pebble;
|
using namespace Pebble;
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
constexpr bool USE_SECONDS_INSTEAD_OF_MINUTES = false;
|
const bool USE_SECONDS_INSTEAD_OF_MINUTES = false;
|
||||||
|
|
||||||
class MainWindow : public AppWindow, public TickTimer {
|
class MainWindow : public AppWindow, public TickTimer {
|
||||||
DigitLayer digitLayers[4];
|
DigitLayer digitLayers[4];
|
||||||
@ -39,18 +39,19 @@ protected:
|
|||||||
TickTimerStart(HOUR_UNIT);
|
TickTimerStart(HOUR_UNIT);
|
||||||
TickTimerStart(USE_SECONDS_INSTEAD_OF_MINUTES ? SECOND_UNIT : MINUTE_UNIT);
|
TickTimerStart(USE_SECONDS_INSTEAD_OF_MINUTES ? SECOND_UNIT : MINUTE_UNIT);
|
||||||
UpdateTime(false);
|
UpdateTime(false);
|
||||||
ApplySettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTime(bool animate=true) {
|
void UpdateTime(bool animate=true) {
|
||||||
DateTime dateTime = DateTime::Now();
|
DateTime dateTime = DateTime::Now();
|
||||||
int hour = settings::FormatHour(dateTime.GetHour());
|
int hour = dateTime.GetHour();
|
||||||
int minute = USE_SECONDS_INSTEAD_OF_MINUTES ? dateTime.GetSecond() : dateTime.GetMinute();
|
int minute = USE_SECONDS_INSTEAD_OF_MINUTES ? dateTime.GetSecond() : dateTime.GetMinute();
|
||||||
|
bool is_24h = clock_is_24h_style();
|
||||||
|
if (!is_24h) hour %= 12;
|
||||||
|
|
||||||
// digitLayers[0].SetDigitCount(is_24h ? 3 : 2);
|
digitLayers[0].SetDigitCount(is_24h ? 3 : 2);
|
||||||
// digitLayers[1].SetDigitCount(is_24h ? 24 : 12);
|
digitLayers[1].SetDigitCount(is_24h ? 24 : 12);
|
||||||
// digitLayers[2].SetDigitCount(6);
|
digitLayers[2].SetDigitCount(6);
|
||||||
// digitLayers[3].SetDigitCount(10);
|
digitLayers[3].SetDigitCount(10);
|
||||||
this->digitLayers[0].RotateTo(hour / 10, animate);
|
this->digitLayers[0].RotateTo(hour / 10, animate);
|
||||||
this->digitLayers[1].RotateTo(hour, animate);
|
this->digitLayers[1].RotateTo(hour, animate);
|
||||||
this->digitLayers[2].RotateTo(minute / 10, animate);
|
this->digitLayers[2].RotateTo(minute / 10, animate);
|
||||||
@ -60,34 +61,34 @@ protected:
|
|||||||
void OnTick(tm &tick_time, TimeUnits units_changed) {
|
void OnTick(tm &tick_time, TimeUnits units_changed) {
|
||||||
UpdateTime(true);
|
UpdateTime(true);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
namespace {
|
||||||
void ApplySettings() {
|
void ApplySettings() {
|
||||||
this->SetBackgroundColor(settings::GetBackgroundColor());
|
Pebble::Window window = window_stack_get_top_window();
|
||||||
this->UpdateTime(false);
|
window.SetBackgroundColor(settings::GetBackgroundColor());
|
||||||
|
window.MarkDirty();
|
||||||
|
|
||||||
bitmaps::SetDigitColor(settings::GetDigitColor());
|
bitmaps::SetDigitColor(settings::GetDigitColor());
|
||||||
bitmaps::SetFrameColor(settings::GetFrameColor());
|
bitmaps::SetFrameColor(settings::GetFrameColor());
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
namespace {
|
void HandleMsg(DictionaryIterator *iter, void *context) {
|
||||||
void HandleMsg(DictionaryIterator* iter, void* context) {
|
|
||||||
settings::HandleMsg(iter);
|
settings::HandleMsg(iter);
|
||||||
static_cast<MainWindow*>(context)->ApplySettings();
|
ApplySettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MAIN {
|
MAIN {
|
||||||
bitmaps::Init();
|
bitmaps::Init();
|
||||||
settings::Load();
|
settings::Load();
|
||||||
MainWindow window;
|
|
||||||
window.StackPush(true);
|
|
||||||
|
|
||||||
app_message_set_context(&window);
|
|
||||||
app_message_register_inbox_received(HandleMsg);
|
app_message_register_inbox_received(HandleMsg);
|
||||||
app_message_open(64, 64); // inbox, outbox
|
app_message_open(64, 64); // inbox, outbox
|
||||||
|
|
||||||
|
MainWindow window;
|
||||||
|
window.StackPush(true);
|
||||||
|
ApplySettings();
|
||||||
|
|
||||||
app_event_loop();
|
app_event_loop();
|
||||||
|
|
||||||
bitmaps::DeInit();
|
bitmaps::DeInit();
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#include <@rebble/sdk-c-utils/macros.h>
|
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
// Built-in GColorFromRGBA doesn't seem to work in C++11 :(
|
// Built-in GColorFromRGBA doesn't seem to work in C++11 :(
|
||||||
@ -17,49 +16,28 @@ namespace settings {
|
|||||||
GColor backgroundColor = GColorWhite;
|
GColor backgroundColor = GColorWhite;
|
||||||
GColor digitColor = GColorBlack;
|
GColor digitColor = GColorBlack;
|
||||||
GColor frameColor = GColorBlack;
|
GColor frameColor = GColorBlack;
|
||||||
int time_format_override = 0;
|
|
||||||
int time_12h_start = 1;
|
|
||||||
int time_24h_start = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Save() {
|
void Save() {
|
||||||
persist_write_data(MESSAGE_KEY_BACKGROUND_COLOR, &backgroundColor, sizeof(GColor));
|
persist_write_data(MESSAGE_KEY_BACKGROUND_COLOR, &backgroundColor, sizeof(GColor));
|
||||||
persist_write_data(MESSAGE_KEY_DIGIT_COLOR, &digitColor, sizeof(GColor));
|
persist_write_data(MESSAGE_KEY_DIGIT_COLOR, &digitColor, sizeof(GColor));
|
||||||
persist_write_data(MESSAGE_KEY_FRAME_COLOR, &frameColor, sizeof(GColor));
|
persist_write_data(MESSAGE_KEY_FRAME_COLOR, &frameColor, sizeof(GColor));
|
||||||
persist_write_data(MESSAGE_KEY_TIME_FORMAT_OVERRIDE, &time_format_override, sizeof(int));
|
|
||||||
persist_write_data(MESSAGE_KEY_12H_START, &time_12h_start, sizeof(int));
|
|
||||||
persist_write_data(MESSAGE_KEY_24H_START, &time_24h_start, sizeof(int));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Load() {
|
void Load() {
|
||||||
persist_read_data(MESSAGE_KEY_BACKGROUND_COLOR, &backgroundColor, sizeof(GColor));
|
persist_read_data(MESSAGE_KEY_BACKGROUND_COLOR, &backgroundColor, sizeof(GColor));
|
||||||
persist_read_data(MESSAGE_KEY_DIGIT_COLOR, &digitColor, sizeof(GColor));
|
persist_read_data(MESSAGE_KEY_DIGIT_COLOR, &digitColor, sizeof(GColor));
|
||||||
persist_read_data(MESSAGE_KEY_FRAME_COLOR, &frameColor, sizeof(GColor));
|
persist_read_data(MESSAGE_KEY_FRAME_COLOR, &frameColor, sizeof(GColor));
|
||||||
persist_read_data(MESSAGE_KEY_TIME_FORMAT_OVERRIDE, &time_format_override, sizeof(int));
|
|
||||||
persist_read_data(MESSAGE_KEY_12H_START, &time_12h_start, sizeof(int));
|
|
||||||
persist_read_data(MESSAGE_KEY_24H_START, &time_24h_start, sizeof(int));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleMsg(DictionaryIterator* iter) {
|
void HandleMsg(DictionaryIterator *iter) {
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_BACKGROUND_COLOR)) backgroundColor = GColorFromHEX(tuple->value->int32);
|
if (auto tuple = dict_find(iter, MESSAGE_KEY_BACKGROUND_COLOR)) backgroundColor = GColorFromHEX(tuple->value->int32);
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_DIGIT_COLOR)) digitColor = GColorFromHEX(tuple->value->int32);
|
if (auto tuple = dict_find(iter, MESSAGE_KEY_DIGIT_COLOR)) digitColor = GColorFromHEX(tuple->value->int32);
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_FRAME_COLOR)) frameColor = GColorFromHEX(tuple->value->int32);
|
if (auto tuple = dict_find(iter, MESSAGE_KEY_FRAME_COLOR)) frameColor = GColorFromHEX(tuple->value->int32);
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_TIME_FORMAT_OVERRIDE)) time_format_override = tuple->value->int8;
|
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_12H_START)) time_12h_start = tuple->value->int8;
|
|
||||||
if (auto tuple = dict_find(iter, MESSAGE_KEY_24H_START)) time_24h_start = tuple->value->int8;
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
GColor GetBackgroundColor() {return backgroundColor;}
|
GColor GetBackgroundColor() {return backgroundColor;}
|
||||||
GColor GetDigitColor() {return digitColor;}
|
GColor GetDigitColor() {return digitColor;}
|
||||||
GColor GetFrameColor() {return frameColor;}
|
GColor GetFrameColor() {return frameColor;}
|
||||||
|
|
||||||
int FormatHour(int hour) {
|
|
||||||
const bool is_24h = time_format_override ? time_format_override == 24 : clock_is_24h_style();
|
|
||||||
if (is_24h) {
|
|
||||||
return (hour + 24 - time_24h_start) % 24 + time_24h_start;
|
|
||||||
} else {
|
|
||||||
return (hour + 12 - time_12h_start) % 12 + time_12h_start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -5,9 +5,8 @@
|
|||||||
namespace settings {
|
namespace settings {
|
||||||
void Save();
|
void Save();
|
||||||
void Load();
|
void Load();
|
||||||
void HandleMsg(DictionaryIterator* iter);
|
void HandleMsg(DictionaryIterator *iter);
|
||||||
GColor GetBackgroundColor();
|
GColor GetBackgroundColor();
|
||||||
GColor GetDigitColor();
|
GColor GetDigitColor();
|
||||||
GColor GetFrameColor();
|
GColor GetFrameColor();
|
||||||
int FormatHour(int hours);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,42 +29,6 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "section",
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
type: "heading",
|
|
||||||
defaultValue: "Time Format",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Time Format",
|
|
||||||
messageKey: "TIME_FORMAT_OVERRIDE",
|
|
||||||
type: "select",
|
|
||||||
options: [
|
|
||||||
{label: "Use system", value: 0},
|
|
||||||
{label: "12 hour", value: 12},
|
|
||||||
{label: "24 hour", value: 24},
|
|
||||||
],
|
|
||||||
defaultValue: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "12h Range",
|
|
||||||
description: "Most people want '1:00 to 12:59'. Some countries use '0:00 to 11:59' instead.",
|
|
||||||
messageKey: "12H_START",
|
|
||||||
type: "select",
|
|
||||||
options: Array.from({length: 12}, (_, i) => ({value: i, label: `${i}:00 to ${i + 11}:59`})),
|
|
||||||
defaultValue: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "24h Range",
|
|
||||||
description: "Most people want '0:00 to 23:59'.",
|
|
||||||
messageKey: "24H_START",
|
|
||||||
type: "select",
|
|
||||||
options: Array.from({length: 24}, (_, i) => ({value: i, label: `${i}:00 to ${i + 23}:59`})),
|
|
||||||
defaultValue: 0,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "submit",
|
type: "submit",
|
||||||
defaultValue: "Save Settings",
|
defaultValue: "Save Settings",
|
||||||
|
|||||||
@ -1,48 +1,3 @@
|
|||||||
var Clay = require('pebble-clay');
|
var Clay = require('pebble-clay');
|
||||||
var clayConfig = require('./config');
|
var clayConfig = require('./config');
|
||||||
var clay = new Clay(clayConfig);
|
var clay = new Clay(clayConfig);
|
||||||
|
|
||||||
|
|
||||||
// Patch `select` to return integers instead of strings
|
|
||||||
|
|
||||||
function disable() {
|
|
||||||
if (this.$manipulatorTarget.get('disabled')) { return this; }
|
|
||||||
this.$element.set('+disabled');
|
|
||||||
this.$manipulatorTarget.set('disabled', true);
|
|
||||||
return this.trigger('disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
function enable() {
|
|
||||||
if (!this.$manipulatorTarget.get('disabled')) { return this; }
|
|
||||||
this.$element.set('-disabled');
|
|
||||||
this.$manipulatorTarget.set('disabled', false);
|
|
||||||
return this.trigger('enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
function hide() {
|
|
||||||
if (this.$element[0].classList.contains('hide')) { return this; }
|
|
||||||
this.$element.set('+hide');
|
|
||||||
return this.trigger('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
function show() {
|
|
||||||
if (!this.$element[0].classList.contains('hide')) { return this; }
|
|
||||||
this.$element.set('-hide');
|
|
||||||
return this.trigger('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
clay.components.select.manipulator = {
|
|
||||||
get: function() {
|
|
||||||
return parseInt(this.$manipulatorTarget.get('value'));
|
|
||||||
},
|
|
||||||
set: function(value) {
|
|
||||||
if (this.get() === value) { return this; }
|
|
||||||
this.$manipulatorTarget.set('value', value);
|
|
||||||
return this.trigger('change');
|
|
||||||
},
|
|
||||||
disable: disable,
|
|
||||||
enable: enable,
|
|
||||||
hide: hide,
|
|
||||||
show: show
|
|
||||||
};
|
|
||||||
|
|
||||||