mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-19 10:58:20 +01:00
fix slider
This commit is contained in:
parent
da342ea574
commit
278ee54b2e
@ -16,9 +16,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
class BaseEvent
|
||||
constructor: (@name) ->
|
||||
constructor: (@name, @force) ->
|
||||
@prevent = false
|
||||
preventDefault: () ->
|
||||
@prevent = true
|
||||
@prevent = true if not @force
|
||||
|
||||
this.OS.GUI.BaseEvent = BaseEvent
|
@ -33,9 +33,9 @@ class BaseModel
|
||||
_GUI.loadScheme p, @, @host
|
||||
|
||||
quit: (force) ->
|
||||
evt = new _GUI.BaseEvent("exit")
|
||||
@onexit(evt) if not force
|
||||
if force or not evt.prevent
|
||||
evt = new _GUI.BaseEvent("exit", force)
|
||||
@onexit(evt)
|
||||
if not evt.prevent
|
||||
delete @.observable
|
||||
@dialog.quit() if @dialog
|
||||
_PM.kill @
|
||||
|
@ -132,14 +132,14 @@ self.OS.GUI =
|
||||
, __("Open with"), list
|
||||
|
||||
forceLaunch: (app, args) ->
|
||||
console.log "This method is used for developing only, please use the launch method instead"
|
||||
console.warn "This method is used for developing only, please use the launch method instead"
|
||||
_GUI.unloadApp app
|
||||
_GUI.launch app, args
|
||||
|
||||
unloadApp: (app) ->
|
||||
_PM.killAll app, true
|
||||
($ _OS.APP[app].style).remove() if _OS.APP[app] and _OS.APP[app].style
|
||||
_OS.APP[app] = undefined
|
||||
delete _OS.APP[app]
|
||||
|
||||
loadApp: (app, ok, err) ->
|
||||
path = "os://packages/#{app}"
|
||||
|
@ -10,6 +10,7 @@
|
||||
this.dragable = eval(opts.dragable)
|
||||
else
|
||||
this.dragable = true
|
||||
this.onchanging = opts.onchanging
|
||||
this.onchange = opts.onchange
|
||||
//this.rid = $(self.root).attr("data-id") || Math.floor(Math.random() * 100000) + 1
|
||||
var self = this
|
||||
@ -20,8 +21,11 @@
|
||||
self[i] = v[i]
|
||||
else
|
||||
self[k] = v
|
||||
if(k == "value" && self.onchange)
|
||||
self.onchange(self.value)
|
||||
if(k == "value")
|
||||
{
|
||||
if(self.onchange) self.onchange(self.value)
|
||||
if(self.onchanging) self.onchanging(self.value)
|
||||
}
|
||||
self.update()
|
||||
}
|
||||
self.root.get = function(k)
|
||||
@ -60,9 +64,10 @@
|
||||
left = left > maxw?maxw : left
|
||||
self.value = left*self.max/maxw
|
||||
calibrate()
|
||||
if(self.onchange) self.onchange(self.value)
|
||||
if(self.onchanging) self.onchanging(self.value)
|
||||
})
|
||||
$(window).on("mouseup", function(e){
|
||||
if(self.onchange) self.onchange(self.value)
|
||||
$(window).unbind("mousemove", null)
|
||||
})
|
||||
})
|
||||
@ -80,6 +85,15 @@
|
||||
})
|
||||
enable_dragging()
|
||||
}
|
||||
$(self.refs.container).click( function(e){
|
||||
var offset = $(self.refs.container).offset()
|
||||
var left = e.clientX - offset.left
|
||||
var maxw = $(self.refs.container).width()
|
||||
self.value = left*self.max/maxw
|
||||
calibrate()
|
||||
if(self.onchange) self.onchange(self.value)
|
||||
if(self.onchanging) self.onchanging(self.value)
|
||||
})
|
||||
self.root.observable.on("calibrate",function(){
|
||||
calibrate()
|
||||
})
|
||||
|
@ -11,6 +11,7 @@ afx-slider div.container{
|
||||
background-color: #e6e6e6;
|
||||
position: relative;
|
||||
padding:0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
afx-slider div.progress {
|
||||
|
Loading…
Reference in New Issue
Block a user