Adding option to specify the button of WebMouseEvent.
This commit is contained in:
parent
5de1b20935
commit
bb102717b4
1 changed files with 16 additions and 0 deletions
|
@ -77,6 +77,21 @@ struct Converter<blink::WebInputEvent::Type> {
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<blink::WebMouseEvent::Button> {
|
||||
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
|
||||
blink::WebMouseEvent::Button* out) {
|
||||
std::string button = base::StringToLowerASCII(V8ToString(val));
|
||||
if (button == "left")
|
||||
*out = blink::WebMouseEvent::Button::ButtonLeft;
|
||||
else if (button == "middle")
|
||||
*out = blink::WebMouseEvent::Button::ButtonMiddle;
|
||||
else if (button == "right")
|
||||
*out = blink::WebMouseEvent::Button::ButtonRight;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<blink::WebInputEvent::Modifiers> {
|
||||
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
|
||||
|
@ -176,6 +191,7 @@ bool Converter<blink::WebMouseEvent>::FromV8(
|
|||
return false;
|
||||
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
|
||||
return false;
|
||||
dict.Get("button", &out->button);
|
||||
dict.Get("globalX", &out->globalX);
|
||||
dict.Get("globalY", &out->globalY);
|
||||
dict.Get("movementX", &out->movementX);
|
||||
|
|
Loading…
Reference in a new issue