Mercurial > code > home > repos > light9
changeset 1749:468a13c4b910
fix dropping effect into timeline
Ignore-this: 9d9b651de46b3d33cd9109b321ec4c5d
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Thu, 24 May 2018 06:23:28 +0000 |
parents | 7ec3eec60ea4 |
children | 0a472b428859 |
files | light9/web/graph.coffee light9/web/timeline/timeline.coffee |
diffstat | 2 files changed, 11 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/graph.coffee Thu May 24 06:04:12 2018 +0000 +++ b/light9/web/graph.coffee Thu May 24 06:23:28 2018 +0000 @@ -217,7 +217,7 @@ for q in qs if not q.equals throw new Error("doesn't look like a proper Quad") - if not q.subject.id or not q.graph.id? + if not q.subject.id or not q.graph.id? or not q.predicate.id? throw new Error("corrupt patch: #{JSON.stringify(q)}") _applyPatch: (patch) ->
--- a/light9/web/timeline/timeline.coffee Thu May 24 06:04:12 2018 +0000 +++ b/light9/web/timeline/timeline.coffee Thu May 24 06:23:28 2018 +0000 @@ -1,5 +1,4 @@ log = console.log -RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' Drawing = window.Drawing ROW_COUNT = 7 @@ -38,19 +37,19 @@ makeNewNote: (song, effect, dropTime, desiredWidthT) -> U = (x) => @graph.Uri(x) - quad = (s, p, o) => {subject: s, predicate: p, object: o, graph: song} + quad = (s, p, o) => @graph.Quad(s, p, o, song) - newNote = @graph.nextNumberedResource("#{@song.value}/n") + newNote = @graph.nextNumberedResource("#{song.value}/n") newCurve = @graph.nextNumberedResource("#{newNote.value}c") points = @graph.nextNumberedResources("#{newCurve.value}p", 4) curveQuads = [ quad(song, U(':note'), newNote) - quad(newNote, RDF + 'type', U(':Note')) + quad(newNote, U('rdf:type'), U(':Note')) quad(newNote, U(':originTime'), @graph.LiteralRoundedFloat(dropTime)) quad(newNote, U(':effectClass'), effect) quad(newNote, U(':curve'), newCurve) - quad(newCurve, RDF + 'type', U(':Curve')) + quad(newCurve, U('rdf:type'), U(':Curve')) quad(newCurve, U(':attr'), U(':strength')) ] pointQuads = [] @@ -145,9 +144,8 @@ @addEventListener('iron-resize', @_onIronResize.bind(@)) Polymer.RenderStatus.afterNextRender(this, @_onIronResize.bind(@)) - #zoomed = @$.zoomed - #setupDrop(@dia.shadowRoot.querySelector('svg'), - # zoomed.$.rows, @, zoomed.onDrop.bind(zoomed)) + Polymer.RenderStatus.afterNextRender this, => + setupDrop(@$.zoomed.$.rows, @$.zoomed.$.rows, @, @$.zoomed.onDrop.bind(@$.zoomed)) _onIronResize: -> @viewState.setWidth(@offsetWidth) @@ -373,8 +371,8 @@ # we could probably accept some initial overrides right on the # effect uri, maybe as query params - if not @graph.contains(effect, RDF + 'type', U(':Effect')) - if @graph.contains(effect, RDF + 'type', U(':LightSample')) + if not @graph.contains(effect, U('rdf:type'), U(':Effect')) + if @graph.contains(effect, U('rdf:type'), U(':LightSample')) effect = @project.makeEffect(effect) else log("drop #{effect} is not an effect") @@ -384,8 +382,8 @@ desiredWidthX = @offsetWidth * .3 desiredWidthT = @viewState.zoomInX.invert(desiredWidthX) - @viewState.zoomInX.invert(0) - desiredWidthT = Math.min(desiredWidthT, @zoom.duration() - dropTime) - @project.makeNewNote(U(@song), effect, dropTime, desiredWidthT) + desiredWidthT = Math.min(desiredWidthT, @viewState.zoomSpec.duration() - dropTime) + @project.makeNewNote(U(@song), U(effect), dropTime, desiredWidthT) updateInlineAttrs: (note, config) -> if not config?