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
|
# You should have received a copy of the GNU General Public License
|
||||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
class BaseEvent
|
class BaseEvent
|
||||||
constructor: (@name) ->
|
constructor: (@name, @force) ->
|
||||||
@prevent = false
|
@prevent = false
|
||||||
preventDefault: () ->
|
preventDefault: () ->
|
||||||
@prevent = true
|
@prevent = true if not @force
|
||||||
|
|
||||||
this.OS.GUI.BaseEvent = BaseEvent
|
this.OS.GUI.BaseEvent = BaseEvent
|
@ -33,9 +33,9 @@ class BaseModel
|
|||||||
_GUI.loadScheme p, @, @host
|
_GUI.loadScheme p, @, @host
|
||||||
|
|
||||||
quit: (force) ->
|
quit: (force) ->
|
||||||
evt = new _GUI.BaseEvent("exit")
|
evt = new _GUI.BaseEvent("exit", force)
|
||||||
@onexit(evt) if not force
|
@onexit(evt)
|
||||||
if force or not evt.prevent
|
if not evt.prevent
|
||||||
delete @.observable
|
delete @.observable
|
||||||
@dialog.quit() if @dialog
|
@dialog.quit() if @dialog
|
||||||
_PM.kill @
|
_PM.kill @
|
||||||
|
@ -132,14 +132,14 @@ self.OS.GUI =
|
|||||||
, __("Open with"), list
|
, __("Open with"), list
|
||||||
|
|
||||||
forceLaunch: (app, args) ->
|
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.unloadApp app
|
||||||
_GUI.launch app, args
|
_GUI.launch app, args
|
||||||
|
|
||||||
unloadApp: (app) ->
|
unloadApp: (app) ->
|
||||||
_PM.killAll app, true
|
_PM.killAll app, true
|
||||||
($ _OS.APP[app].style).remove() if _OS.APP[app] and _OS.APP[app].style
|
($ _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) ->
|
loadApp: (app, ok, err) ->
|
||||||
path = "os://packages/#{app}"
|
path = "os://packages/#{app}"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
this.dragable = eval(opts.dragable)
|
this.dragable = eval(opts.dragable)
|
||||||
else
|
else
|
||||||
this.dragable = true
|
this.dragable = true
|
||||||
|
this.onchanging = opts.onchanging
|
||||||
this.onchange = opts.onchange
|
this.onchange = opts.onchange
|
||||||
//this.rid = $(self.root).attr("data-id") || Math.floor(Math.random() * 100000) + 1
|
//this.rid = $(self.root).attr("data-id") || Math.floor(Math.random() * 100000) + 1
|
||||||
var self = this
|
var self = this
|
||||||
@ -20,8 +21,11 @@
|
|||||||
self[i] = v[i]
|
self[i] = v[i]
|
||||||
else
|
else
|
||||||
self[k] = v
|
self[k] = v
|
||||||
if(k == "value" && self.onchange)
|
if(k == "value")
|
||||||
self.onchange(self.value)
|
{
|
||||||
|
if(self.onchange) self.onchange(self.value)
|
||||||
|
if(self.onchanging) self.onchanging(self.value)
|
||||||
|
}
|
||||||
self.update()
|
self.update()
|
||||||
}
|
}
|
||||||
self.root.get = function(k)
|
self.root.get = function(k)
|
||||||
@ -60,9 +64,10 @@
|
|||||||
left = left > maxw?maxw : left
|
left = left > maxw?maxw : left
|
||||||
self.value = left*self.max/maxw
|
self.value = left*self.max/maxw
|
||||||
calibrate()
|
calibrate()
|
||||||
if(self.onchange) self.onchange(self.value)
|
if(self.onchanging) self.onchanging(self.value)
|
||||||
})
|
})
|
||||||
$(window).on("mouseup", function(e){
|
$(window).on("mouseup", function(e){
|
||||||
|
if(self.onchange) self.onchange(self.value)
|
||||||
$(window).unbind("mousemove", null)
|
$(window).unbind("mousemove", null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -80,6 +85,15 @@
|
|||||||
})
|
})
|
||||||
enable_dragging()
|
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(){
|
self.root.observable.on("calibrate",function(){
|
||||||
calibrate()
|
calibrate()
|
||||||
})
|
})
|
||||||
|
@ -11,6 +11,7 @@ afx-slider div.container{
|
|||||||
background-color: #e6e6e6;
|
background-color: #e6e6e6;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding:0;
|
padding:0;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
afx-slider div.progress {
|
afx-slider div.progress {
|
||||||
|
Loading…
Reference in New Issue
Block a user