stop using jquery ui for topic card dragging

This commit is contained in:
Connor Turland 2017-03-22 16:09:47 +00:00
parent a5d5cd6000
commit f2a7cc1f19
6 changed files with 32 additions and 41 deletions

View file

@ -33,7 +33,6 @@
.showcard { .showcard {
position:absolute; position:absolute;
display:none;
top:100px; top:100px;
left:100px; left:100px;
width:300px; width:300px;

View file

@ -151,7 +151,7 @@ const ReactApp = {
metacodeSets: TopicCard.metacodeSets, metacodeSets: TopicCard.metacodeSets,
updateTopic: TopicCard.updateTopic, updateTopic: TopicCard.updateTopic,
onTopicFollow: TopicCard.onTopicFollow, onTopicFollow: TopicCard.onTopicFollow,
redrawCanvas: TopicCard.redrawCanvas redrawCanvas: () => Visualize.mGraph.plot()
} }
}, },
getTopicProps: function() { getTopicProps: function() {

View file

@ -7,9 +7,6 @@ import GlobalUI, { ReactApp } from '../GlobalUI'
const TopicCard = { const TopicCard = {
openTopic: null, // stores the topic that's currently open openTopic: null, // stores the topic that's currently open
metacodeSets: [], metacodeSets: [],
redrawCanvas: () => {
Visualize.mGraph.plot()
},
init: function(serverData) { init: function(serverData) {
const self = TopicCard const self = TopicCard
self.metacodeSets = serverData.metacodeSets self.metacodeSets = serverData.metacodeSets
@ -41,20 +38,11 @@ const TopicCard = {
var topic = node.getData('topic') var topic = node.getData('topic')
self.openTopic = topic self.openTopic = topic
self.render() self.render()
$('.showcard').fadeIn('fast', () => {
$('.showcard').draggable({
handle: '.metacodeImage',
stop: function() {
$(this).height('auto')
}
})
opts.complete && opts.complete()
})
}, },
hideCard: function() { hideCard: function() {
var self = TopicCard var self = TopicCard
$('.showcard').fadeOut('fast')
self.openTopic = null self.openTopic = null
self.render()
} }
} }

View file

@ -77,7 +77,7 @@ export default class MapView extends Component {
toggleMetacode, toggleMapper, toggleSynapse, filterAllMetacodes, toggleMetacode, toggleMapper, toggleSynapse, filterAllMetacodes,
filterAllMappers, filterAllSynapses, filterData, filterAllMappers, filterAllSynapses, filterData,
openImportLightbox, forkMap, openHelpLightbox, openImportLightbox, forkMap, openHelpLightbox,
mapIsStarred, onMapStar, onMapUnstar, mapIsStarred, onMapStar, onMapUnstar, openTopic,
onZoomExtents, onZoomIn, onZoomOut, hasLearnedTopicCreation } = this.props onZoomExtents, onZoomIn, onZoomOut, hasLearnedTopicCreation } = this.props
const { chatOpen } = this.state const { chatOpen } = this.state
const onChatOpen = () => { const onChatOpen = () => {
@ -107,7 +107,7 @@ export default class MapView extends Component {
filterAllMappers={filterAllMappers} filterAllMappers={filterAllMappers}
filterAllSynapses={filterAllSynapses} /> filterAllSynapses={filterAllSynapses} />
<DataVis /> <DataVis />
<TopicCard {...this.props} /> {openTopic && <TopicCard {...this.props} />}
{currentUser && <Instructions mobile={mobile} hasLearnedTopicCreation={hasLearnedTopicCreation} />} {currentUser && <Instructions mobile={mobile} hasLearnedTopicCreation={hasLearnedTopicCreation} />}
{currentUser && <MapChat {...this.props} onOpen={onChatOpen} onClose={onChatClose} chatOpen={chatOpen} ref={x => this.mapChat = x} />} {currentUser && <MapChat {...this.props} onOpen={onChatOpen} onClose={onChatClose} chatOpen={chatOpen} ref={x => this.mapChat = x} />}
<VisualizationControls map={map} <VisualizationControls map={map}

View file

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react' import React, { PropTypes, Component } from 'react'
import Draggable from 'react-draggable'
import Title from './Title' import Title from './Title'
import Links from './Links' import Links from './Links'
@ -30,6 +31,7 @@ class ReactTopicCard extends Component {
if (topic.authorizePermissionChange(currentUser)) classname += ' yourTopic' if (topic.authorizePermissionChange(currentUser)) classname += ' yourTopic'
return ( return (
<Draggable handle=".metacodeImage" defaultPosition={{x: 100, y: 100}}>
<div className="showcard mapElement mapElementHidden" id="showcard"> <div className="showcard mapElement mapElementHidden" id="showcard">
<div className={classname}> <div className={classname}>
<div className={`CardOnGraph ${hasAttachment ? 'hasAttachment' : ''}`} id={`topic_${topic.id}`}> <div className={`CardOnGraph ${hasAttachment ? 'hasAttachment' : ''}`} id={`topic_${topic.id}`}>
@ -56,6 +58,7 @@ class ReactTopicCard extends Component {
</div> </div>
</div> </div>
</div> </div>
</Draggable>
) )
} }
} }

View file

@ -44,6 +44,7 @@
"outdent": "0.3.0", "outdent": "0.3.0",
"react": "15.4.2", "react": "15.4.2",
"react-dom": "15.4.2", "react-dom": "15.4.2",
"react-draggable": "2.2.3",
"react-dropzone": "3.9.1", "react-dropzone": "3.9.1",
"react-onclickoutside": "5.9.0", "react-onclickoutside": "5.9.0",
"react-router": "3.0.2", "react-router": "3.0.2",