Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-frontend
Commits
1d0ed3fe
Commit
1d0ed3fe
authored
5 years ago
by
L4929
Browse files
Options
Downloads
Patches
Plain Diff
Can now delete text box by clicking on tooltip. Also cleaned some code
parent
6a7997ef
No related branches found
No related tags found
3 merge requests
!21
Development
,
!15
Get game creation to user-marker-database-interactions
,
!10
Add text
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/App.css
+1
-11
1 addition, 11 deletions
src/App.css
src/components/DrawTools.js
+13
-29
13 additions, 29 deletions
src/components/DrawTools.js
with
14 additions
and
40 deletions
src/App.css
+
1
−
11
View file @
1d0ed3fe
...
...
@@ -148,13 +148,6 @@ div.login button:hover {
/* Editing tooltips */
.leaflet-tooltip
{
font-size
:
18px
;
/* by default leaflet doesn't allow selecting content in tooltips; overriding */
-webkit-user-select
:
text
;
-moz-user-select
:
text
;
-ms-user-select
:
text
;
user-select
:
text
;
pointer-events
:
all
;
cursor
:
auto
;
/* Overriding tooltip layout by making it invisible */
background-color
:
transparent
;
box-shadow
:
none
;
...
...
@@ -162,10 +155,7 @@ div.login button:hover {
padding
:
0
;
}
.leaflet-clickable
{
pointer-events
:
all
;
}
/* remove the small triangle on tooltip */
.leaflet-tooltip-bottom
:before
{
border
:
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/components/DrawTools.js
+
13
−
29
View file @
1d0ed3fe
...
...
@@ -8,7 +8,7 @@ import { FeatureGroup } from "react-leaflet";
L
.
Draw
.
MarkerTextBox
=
L
.
Draw
.
Marker
.
extend
({
options
:
{
icon
:
L
.
divIcon
({
className
:
"
dummy
"
,
className
:
"
"
,
// empty class to override default styling
iconSize
:
[
20
,
20
],
iconAnchor
:
[
10
,
20
]
}),
...
...
@@ -23,7 +23,7 @@ L.Draw.MarkerTextBox = L.Draw.Marker.extend({
});
// Overriding default toolbar
// Just adding one new button
,
though
,
lol
// Just adding one new button though lol
L
.
DrawToolbar
.
include
({
getModeHandlers
:
function
(
map
)
{
return
[
...
...
@@ -88,10 +88,15 @@ class DrawTools extends Component {
interactive
:
true
});
// disable dragging when
mousedown is active on top of
marker (tooltip)
// disable dragging when
cursor is over
marker (tooltip)
// clicking on tooltip fires the marker's click handler, hence e.layer.on
e
.
layer
.
on
(
"
mousedown
"
,
function
()
{
L
.
DomEvent
.
disableClickPropagation
(
tooltip
);
e
.
layer
.
on
(
"
mouseover
"
,
function
()
{
e
.
layer
.
_map
.
dragging
.
disable
();
});
// enable dragging again when cursor is out of marker (tooltip)
e
.
layer
.
on
(
"
mouseout
"
,
function
()
{
e
.
layer
.
_map
.
dragging
.
enable
();
});
// show placeholder text again upon emptying textbox
...
...
@@ -107,33 +112,12 @@ class DrawTools extends Component {
tooltip
.
innerHTML
=
'
<div placeholder="Click here and type" contenteditable="true"></div>
'
;
}
console
.
log
(
tooltip
.
firstChild
.
childNodes
.
length
);
let
margintop
=
tooltip
.
firstChild
.
childNodes
.
length
*
40
;
console
.
log
(
e
.
layer
);
//tooltip.style.marginTop = margintop.toString() + "px";
/*
let editable = document.querySelector(".editable");
let editableStyle = getComputedStyle(editable);
let horizontalLoc = parseInt(editableStyle.height.replace("px", ""));
let verticalLoc = parseInt(editableStyle.width.replace("px", ""));
let trueHorizontalLoc = horizontalLoc + 40;
let trueVerticalLoc = verticalLoc + 10;
tooltip.style.marginTop = horizontalLoc.toString() + "px";
*/
/*
editable.firstChild.style.marginTop = toString(
trueHorizontalLoc + "px"
);
console.log("editable.firstChild.style: ");
console.log(editable.firstChild.style);
*/
});
}
}
// end if (e.layerType === "textbox")
// turning layer data to GeoJSON
this
.
makeGeoJSON
(
e
.
layer
);
};
};
// end _onCreated
makeGeoJSON
=
e
=>
{
let
geoJSON
=
e
.
toGeoJSON
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment