From 9e5fc1baba81bf1b629728156eb3a776287f257e Mon Sep 17 00:00:00 2001 From: vjrj Date: Wed, 20 Dec 2017 01:31:39 +0100 Subject: [PATCH] Added area removing --- designs/icons-tcef.svg | 28 +++++++--- imports/ui/components/Maps/Icons.js | 14 +++-- .../components/SelectionMap/SelectionMap.js | 20 +++++-- .../ui/pages/Subscriptions/Subscriptions.js | 49 ++---------------- public/remove-marker.png | Bin 0 -> 582 bytes 5 files changed, 49 insertions(+), 62 deletions(-) create mode 100644 public/remove-marker.png diff --git a/designs/icons-tcef.svg b/designs/icons-tcef.svg index 1695da9..8f82ffd 100644 --- a/designs/icons-tcef.svg +++ b/designs/icons-tcef.svg @@ -245,14 +245,14 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.24748737" - inkscape:cx="-594.08486" - inkscape:cy="654.87036" + inkscape:zoom="0.25" + inkscape:cx="-324.9908" + inkscape:cy="1157.3585" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1920" - inkscape:window-height="983" + inkscape:window-height="1016" inkscape:window-x="0" inkscape:window-y="867" inkscape:window-maximized="1" /> @@ -264,7 +264,7 @@ image/svg+xml - + @@ -481,5 +481,21 @@ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:9.36170292;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - + diff --git a/imports/ui/components/Maps/Icons.js b/imports/ui/components/Maps/Icons.js index 47f5e29..7d8dc1f 100644 --- a/imports/ui/components/Maps/Icons.js +++ b/imports/ui/components/Maps/Icons.js @@ -16,18 +16,16 @@ export const nFireIcon = new Leaflet.Icon({ iconUrl: '/n-fire-marker.png', iconSize: [16, 24], // size of the icon iconAnchor: [8, 26] // point of the icon which will correspond to marker's location - /* shadowUrl: require('../public/marker-shadow.png'), */ - /* shadowSize: [50, 64], // size of the shadow */ - /* shadowAnchor: [4, 62], // the same for the shadow - * popupAnchor: [-3, -76]// point from which the popup should open relative to the iconAnchor */ }); export const positionIcon = new Leaflet.Icon({ iconUrl: '/your-position.png', iconSize: [50, 77], // size of the icon iconAnchor: [25, 82] // point of the icon which will correspond to marker's location - /* shadowSize: [50, 64], // size of the shadow */ - /* shadowUrl: require('../public/marker-shadow.png'), */ - /* shadowAnchor: [4, 62], // the same for the shadow - * popupAnchor: [-3, -76]// point from which the popup should open relative to the iconAnchor */ +}); + +export const removeIcon = new Leaflet.Icon({ + iconUrl: '/remove-marker.png', + iconSize: [24, 24], // size of the icon + iconAnchor: [12, 12] // point of the icon which will correspond to marker's location }); diff --git a/imports/ui/components/SelectionMap/SelectionMap.js b/imports/ui/components/SelectionMap/SelectionMap.js index 3616aaa..940bd83 100644 --- a/imports/ui/components/SelectionMap/SelectionMap.js +++ b/imports/ui/components/SelectionMap/SelectionMap.js @@ -12,7 +12,7 @@ import { translate } from 'react-i18next'; import { withTracker } from 'meteor/react-meteor-data'; import update from 'immutability-helper'; import geolocation from '/imports/startup/client/geolocation'; -import { positionIcon } from '/imports/ui/components/Maps/Icons'; +import { positionIcon, removeIcon } from '/imports/ui/components/Maps/Icons'; import DefMapLayers from '/imports/ui/components/Maps/DefMapLayers'; import 'leaflet-graphicscale/dist/Leaflet.GraphicScale.min.css'; import 'leaflet-graphicscale/dist/Leaflet.GraphicScale.min.js'; @@ -151,6 +151,7 @@ class SelectionMap extends Component { } render() { + const { t, onRemove } = this.props; return (
{ this.isValidState() && @@ -169,10 +170,22 @@ class SelectionMap extends Component { onViewportChanged={this.onViewportChanged} sleepNote hoverToWake - wakeMessage={this.props.t('Pulsa para activar')} + wakeMessage={t('Pulsa para activar')} sleepOpacity={0.6} > + {this.props.action === action.edit && + this.props.currentSubs.map(subs => ( + { onRemove(subs._id); }} + /> + )) + } {this.props.action === action.add && { this.marker = ref; }} /> this.onViewportChanged(viewport)} loadingSubs={this.props.loading} currentSubs={this.props.subscriptions} + onRemove={(id) => { this.handleRemove(id); }} /> - {subscriptions.length ? - - - - - - - - - - {subscriptions.map(({ - _id, - location, - createdAt, - updatedAt - }) => ( - - - - - - - - ))} - -
LugarActualizadoCreado - - -
{location.lat},{location.lon}{timeago(updatedAt)}{timeago(createdAt)} - - - -
: - No estás suscrito a fuegos en ninguna zona + { subscriptions.length === 0 && + No estás suscrito a fuegos en ninguna zona }
) : ); diff --git a/public/remove-marker.png b/public/remove-marker.png new file mode 100644 index 0000000000000000000000000000000000000000..fda9ecd66884d1d08f1a5360780138a108e98d51 GIT binary patch literal 582 zcmV-M0=fN(P)JJbSJEbv-5D5bwLvQ8w^!9CizR4Z#^PKzKbI-Z&IX5Ea6Z8Y)z%Y;j zx*T;6TmVI2KZ46Rose)!uqSvEsL6N}6a>ju#is?2EePB3AegjzkrAH-mMsok1Lr`= z%~QY-&{OXpvk|O@Jf9N08?R0UBdXsJLAzkg+4yVT1rydd83@acptEr>Ki4J%n}Kj8 zeWQXg*fJsm0pS5N-!>ZgD$#Fl%c&sYEzCJQ*91$LaJ>pr2o}uFBLSi6$b~S^K5Mvn z1jimwswPyB`N9>=xHXaB#>0;g+ZJa=c`YycEKmEkG9N^|<0+|7htd zxo3{NZQ}Z!Qc>{9-!67fs&vB|!)b-fbyneW9XT#ku0I=(Z8$T)ip7C4a0Xntc^Vj` zHla>}nF!Y6j{K9BInhwqY?2b}sW