From 8740559d283265440a5d11a22e22b154427ed392 Mon Sep 17 00:00:00 2001 From: "proxy.zeroomega" Date: Tue, 17 Dec 2024 09:33:02 +0800 Subject: [PATCH] Refreshing the page in builtin profile bug #71 --- .../src/omega/controllers/builtin.coffee | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/omega-web/src/omega/controllers/builtin.coffee b/omega-web/src/omega/controllers/builtin.coffee index d2fea16..99ca8b4 100644 --- a/omega-web/src/omega/controllers/builtin.coffee +++ b/omega-web/src/omega/controllers/builtin.coffee @@ -2,14 +2,24 @@ angular.module('omega').controller 'BuiltinCtrl', ($scope, $stateParams, $location, $rootScope, $timeout, $state, $modal, builtinProfiles, profileColorPalette, - getAttachedName, getParentName, getVirtualTarget + getAttachedName, getParentName, getVirtualTarget, + omegaTarget ) -> - customBuiltinProfiles = Object.assign( - {}, builtinProfiles, $rootScope.options['-builtinProfiles'] - ) - #$rootScope.options['-builtinProfiles'] = customBuiltinProfiles - $scope.systemProfile = customBuiltinProfiles['+system'] - $scope.directProfile = customBuiltinProfiles['+direct'] + + customBuiltinProfiles = {} + + decorateBuiltinProfile = (newOptions) -> + Object.assign( + customBuiltinProfiles, + builtinProfiles, + newOptions?['-builtinProfiles'] + ) + $scope.systemProfile = customBuiltinProfiles['+system'] + $scope.directProfile = customBuiltinProfiles['+direct'] + + omegaTarget.addOptionsChangeCallback decorateBuiltinProfile + + decorateBuiltinProfile($rootScope.options) $scope.moveColor = (color, key) -> customBuiltinProfiles[key].color = color # make sure options watcher watch value changed